Static Methods

Trigonom Trigonom Trigonom etry: etry: etry: (radians)

Math.cos(x)

Math.cosh(x)

Math.sin(x)

Math.sinh(x)

Math.tan(x)

Math.tanh(x)

Math.acos(x)

Math.acosh(x)

Math.asin(x)

Math.asinh(x)

Math.atan(x)

Math.atanh(x)

Math.atan2(y, x) Returns the arctangent of the quotient of its arguments.

Integer: Integer: Integer:

Math.ceil(x)

Returns the smallest integer greater than or equal to x.

Math.floor(x)

Returns the largest integer less than or equal to x.

Math.fround(x)

Returns the nearest single-precision float representation of x.

Math.round(x)

Returns the value of x rounded to the nearest integer.

Math.trunc(x)

Returns the integral part of the number x, removing any fractional digits.

Math.clz32(x)

Returns the number of leading zeroes of a 32-bit integer.

Math.imul(x, y)

Returns the result of a 32-bit integer multiplication.

Logarithmic / Exponential / Power / Root: Logarithmic / Exponential / Power / Root: Logarithmic / Exponential / Power / Root:

Math.exp(x)

Returns Ex, where x is the argument, and E is Euler's constant (2.718...), the base of the natural logarithm.

Math.expm1(x)

Returns subtracting 1 from exp(x).

Math.log(x)

Returns the natural logarithm (loge, also ln) of x.

Math.log1p(x)

Returns the natural logarithm (loge, also ln) of 1 + x for a number x.

Math.log10(x)

Returns the base 10 logarithm of x.

Math.log2(x)

Returns the base 2 logarithm of x.

Math.pow(x, y)

Returns base to the exponent power, that is, xy.

Math.cbrt(x)

Returns the cube root of a number.

Math.sqrt(x)

Returns the positive square root of a number.

Math.hypot([x[, y[, ...]]])

Returns the square root of the sum of squares of its arguments.

Miscellaneous: Miscellaneous: Miscellaneous:

Math.max([x[, y[, ...]]])

Returns the largest of zero or more numbers.

Math.min([x[, y[, ...]]])

Returns the smallest of zero or more numbers.

Math.sign(x)

Returns the sign of the x, indicating whether x is positive, negative or zero.

Math.abs(x)

Returns the absolute value of a number.

Math.random()

Returns a pseudo-random number between 0 and 1.


RESETRUNFULL
<!DOCTYPE html><html><body><script>

console.log(Math.clz32(1));  // 32console.log(Math.fround(Math.sin(30/180*Math.PI))); // 0.5console.log(Math.sign(-3));  // -1console.log(Math.max(-3,4,5,-1,0));  // 5console.log(Math.round(Math.random()*100)); // 92

</script></body><html>

RESETRUNFULL
<!DOCTYPE html><html><body><script>

console.log(Math.random().toString(36)
                                       .substr(2, 5)); //l8ed3// 5 random alphanumeric characters, // for a random ID perhaps

</script></body><html>