Skip to content
JavaScript

Math API Reference

JavaScript Math object — constants and functions for numbers.

By EZ4Code Team

Math

Built-in object with mathematical constants and functions.

Math.max(...values)

Return the largest of zero or more numbers. Returns -Infinity with no args.

Returns: number

Math.min(...values)

Return the smallest of zero or more numbers. Returns Infinity with no args.

Returns: number

Math.round(x)

Return the value of x rounded to the nearest integer.

Returns: number

Math.floor(x)

Return the largest integer less than or equal to x.

Returns: number

Math.ceil(x)

Return the smallest integer greater than or equal to x.

Returns: number

Math.abs(x)

Return the absolute value of x.

Returns: number

Math.pow(base, exponent)

Return base raised to the exponent power (equivalent to base ** exponent).

Returns: number

Math.sqrt(x)

Return the positive square root of x. Returns NaN if x < 0.

Returns: number

Math.random()

Return a pseudo-random number in [0, 1).

Returns: number

More JavaScript API References