Math functions

JS functions for Maths.

Math cal­cula­ti­on­s

Example of doing math calculations within JS.

Math­.ata­n(value)

Returns the arctangent (in radians) of a number. The returned value is between -π/2 and π/2.

Math.­ran­d­om

Returns a number, decimal between 0 and 1.

Math.­cos(angle)

Returns the cosine of a number in radians. The returned value is between -1 and 1.

Math.­PI

Returns the number PI.

Math.­sin(angle)

Returns the sine of a number in radians. The returned value is between -1 and 1.

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.