This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

log

Summary

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

Syntax

Math.log( number )
number
A number.

Return Value

If number is positive, this function returns the natural logarithm of the number. If number is negative, this function returns NaN. If number is 0, this function returns -Infinity.

Examples

The following code shows how to use this function.

var numArr = [ 45.3, 69.0, 557.04, 0.222 ];

 for (i in numArr) {
     document.write(Math.log(numArr[i]));
     document.write("<br/>");
 }

 // Output:
 // 3.8133070324889884
 // 4.23410650459726
 // 6.322637050634291
 // -1.5050778971098575

See also

Other articles

Attributions