Skip to content

Latest commit

 

History

History
67 lines (56 loc) · 1.52 KB

File metadata and controls

67 lines (56 loc) · 1.52 KB
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
devlang-javascript
language-reference
log
JavaScript
TypeScript
DHTML
log method
Math object
5d617fb5-4b27-404e-842f-eea5549a7c1a
9
mikejo5000
mikejo
ghogen

Math.log Function (JavaScript)

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

Syntax

Math.log(number)   

Parameters

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.

Example

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  

Requirements

[!INCLUDEjsv1]

Applies To: Math Object

See Also

Math.sqrt Function