| title | ms.custom | ms.date | ms.prod | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Math.log Function (JavaScript) | Microsoft Docs |
01/18/2017 |
windows-client-threshold |
|
language-reference |
|
|
|
5d617fb5-4b27-404e-842f-eea5549a7c1a |
9 |
mikejo5000 |
mikejo |
ghogen |
Returns the natural logarithm (base e) of a number.
Math.log(number)
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) {
document.write(Math.log(numArr[i]));
document.write("<br/>");
}
// Output:
// 3.8133070324889884
// 4.23410650459726
// 6.322637050634291
// -1.5050778971098575 [!INCLUDEjsv1]
Applies To: Math Object