log Function

Top  Previous  Next

Returns the natural logarithm (base E) of a number.

Syntax

Math.log(number)

Arguments

numberA number.

Return Value

A number which represents the natural logarithm of the given argument. If the argument is 0, the return value is -Infinity. If the argument is negative, it returns NaN.

Example

Math.log(0);          // Returns -Infinity

Math.log(2);          // Returns 0.6931472

See also

Math.exp