Math functions

JS functions for Maths.

Math cal­cula­ti­on­s

Example of doing math calculations within JS.

Math­.ata­n
Math.­ran­d­om

Returns a number, decimal between 0 and 1.

Math.­cos
Math.­PI

Returns the number PI.

Math.­sin(value)
Math.sq­rt(value)

Calculates and returns the square root of a number.

Math.­tan(angle)

Returns the tangent of a number in radians

Math­.ab­s(value)

Turns any number into a positive number. If positive no change, if negative the value is multiplied by -1.

Math.­pow(base, exponent)

Returns the value of a base raised to a power

Math.­cei­l(value)

Rounds a number always upwards direction.

Math.f­lo­or(value)

Rounds a number always downwards direction.

Math.­rou­nd(value)

Rounds a number to the closest whole number.