JavaScript Math max() method18 Mar 2025 | 1 min read The JavaScript math max() method compares the given numbers and returns the maximum value. SyntaxThe max() method is represented by the following syntax: Parameternum1,num2,....,numN - Numbers to be compared.. ReturnA maximum value of the given numbers. JavaScript Math max() method exampleHere, we will understand max() method through various examples. Example 1Let's see a simple example to print the maximum value of the given numbers. Output: 34 -10 Example 2Let's see an example to print the maximum value of the given array. Output: 15 Next TopicJavaScript Math |
JavaScript The JavaScript math sin() method returns the sine of the given number. The value returned by sin() method ranges between -1 to 1, which represents the sine of the angle. Syntax The sin() method is represented by the following syntax: Math.sin(num) Parameter num - A number. Return The sine of the...
1 min read
JavaScript The JavaScript math sign() method returns the sign of the number. It indicates whether the given number is positive, negative or zero. Syntax The sign() method is represented by the following syntax: Math.sign(num) Parameter num - A number. Return The sign of the given number. JavaScript example Here, we will understand sign()...
1 min read
JavaScript The JavaScript math round() method rounds up the given number up to the closest integer value and returns it. If the given number is already an integer, the round() method returns it directly. Syntax The round() method is represented by the following syntax: Math.round(num) Parameter num - A number. Return The...
1 min read
JavaScript The JavaScript math hypot() method returns the square root of sum of the squares of given numbers. It returns NaN, if any argument cannot be converted to a number. Syntax The hypot() method is represented by the following syntax: Math.hypot([num1[, num2[, ...]]]) Parameter Num - A number. Return The square root...
1 min read
JavaScript The JavaScript math cos() method returns the cosine of the given number. The value returned by cos() method ranges -1 to 1, which represents the cosine of the angle. Syntax The cos() method is represented by the following syntax: Math.cos(num) Parameter num - A number. Return The cosine of a number. JavaScript...
1 min read
JavaScript The JavaScript math tanh() method returns the hyperbolic tangent of the given number. Syntax The tanh() method is represented by the following syntax: The tanh() method is represented by the following syntax: Parameter num - A number. Return The hyperbolic tangent of a number. JavaScript example Here, we will understand tanh() method...
1 min read
JavaScript The JavaScript math pow() method returns the base to the exponent power such as baseexponent. In other words, the base value (x) is multiplied with itself exponent times (y). Syntax The pow() method is represented by the following syntax: Math.pow(base,exponent) Parameter Base - The base number. Exponent - The number...
1 min read
JavaScript The JavaScript math log() method returns the natural logarithm of the given number i.e. base e. If the number is negative, it returns NaN. Syntax The log() method is represented by the following syntax: Math.log(num) Parameter num - A number. Return The natural logarithm of a number. JavaScript example Here, we will...
1 min read
JavaScript The JavaScript math random() method returns the random number between 0 (inclusive) and 1 (exclusive). Syntax The random() method is represented by the following syntax: Math.random() Return The random number between 0 (inclusive) and 1 (exclusive). JavaScript example Here, we will understand random() method through various examples. Example 1 Let's see an...
1 min read
JavaScript The JavaScript math min() method compares the given numbers and returns the minimum value. Syntax The min() method is represented by the following syntax: Math.min(num1,num2,...,numN) Parameter num1,num2,...,numN - Numbers to be compared.. Return A minimum value of the given numbers. JavaScript example Here, we will understand min() method through various examples. Example 1 Let's...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India