![]() |
JavaScript provides a built-in Math object that provides a set of methods to perform mathematical operations. These operations range from basic to more complex functions like trigonometry and logarithms. The Math object allows you to perform calculations without the need for writing custom functions. Syntax:Math.methodName(argument1, argument2, ...);
The Math object in JavaScript provides a variety of methods to perform various mathematical operations, some of the Math object methods are listed below:
Example 1: This example is demonstrating using of Math object methods to perform trigonometry, exponents, and logarithms operations. Javascript
Output
Sine: 0.7071067811865475 Cosine: 0.7071067811865476 Tangent: 0.9999999999999999 Power: 8 Square Root: 3.1622776601683795 Natural Logarithm: 2.302585092994046 Exponential: 22026.465794806718 Example 2: This example is demonstrating using of Math object method Math.random() to generate random number between 1 to 100. HTML
Output: |
Reffered: https://www.geeksforgeeks.org
Geeks Premier League |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |