JavaScript Math pow() method
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:
1. [Link](base,exponent)
Parameter
Base - The base number.
Exponent - The number used to raise the base.
Return
The value of base to the power of exponent.
JavaScript Math pow() method example
1. <script>
2. [Link]([Link](2,3)+"<br>");
3.
4. </script>
JavaScript Math round() method
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:
1. [Link](num)
Parameter
num - A number.
Return
The closest integer value of the given number.
JavaScript Math round() method example
1. <script>
2. [Link]([Link](7.2)+"<br>");
3. [Link]([Link](0.6));
4. </script>
Example 2
1. <script>
2. [Link]([Link](-7.2)+ "<br>");
3. [Link]([Link](-0.6));
4. </script>
JavaScript Math sqrt() method
The JavaScript math sqrt() method returns the square root of a number. If the provided
number is negative, it returns NaN.
Syntax
The sqrt() method is represented by the following syntax:
1. [Link](num)
Parameter
num - A number.
Return
The square root of the given number.
JavaScript Math sqrt() method example
Example 1
1. <script>
2. [Link]([Link](16)+ "<br>");
3. [Link]([Link](12));
4. </script>
Example 2
1. <script>
2. [Link]([Link]()+ "<br>");
3. [Link]([Link](-9));
4. </script>
JavaScript Math sign() method
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:
1. [Link](num)
Parameter
num - A number.
Return
The sign of the given [Link] 1 for positive number and -1 for negative number.
JavaScript Math sign() method example
1. <script>
2. [Link]([Link](12)+"<br>");
3. [Link]([Link](-12)+"<br>");
4. [Link]([Link](0));
5. </script>
JavaScript Math trunc() method
The JavaScript math trunc() method removes the fractional part of the given number and
returns the remaining integer part only.
Syntax
The trunc() method is represented by the following syntax:
1. [Link](num)
Parameter
num - A number.
Return
The integer part of the given number.
JavaScript Math trunc() method example
1. <script>
2. [Link]([Link](12.24)+ "<br>");
3. [Link]([Link](0.84));
4. </script>
JavaScript Math random() method
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:
1. [Link]()
Return
The random number between 0 (inclusive) and 1 (exclusive).
JavaScript Math random() method example
example to find out the random number between 0 and 1.
1. <script>
2. [Link]([Link]())
3. </script>