The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Math.log Function (JavaScript)

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



A number.

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.

The following code shows how to use this function.

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

for (i in numArr) {

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

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Applies To: Math Object (JavaScript)

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft