JavaScript log() Method
Clash Royale CLAN TAG#URR8PPP
<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]-->
JavaScript log() Method
❮ JavaScript Math Object
Example
Return the natural logarithm of the number "2":
Math.log(2);
<!--
The result will be:
0.6931471805599453
-->Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The log() method returns the natural logarithm (base E) of a number.
Note: If the parameter x is negative, NaN is returned.
Note: If the parameter x is 0, -Infinity is returned.
Browser Support
Method | |||||
---|---|---|---|---|---|
log() | Yes | Yes | Yes | Yes | Yes |
Syntax
Math.log(x)
Parameter Values
Parameter | Description |
---|---|
x | Required. A number |
<!--
mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]-->
Technical Details
Return Value: | A Number, representing the natural logarithm of a specified number |
---|---|
JavaScript Version: | ECMAScript 1 |
More Examples
Example
Use the log() method on different numbers:
var a = Math.log(2.7183);
var b = Math.log(2);
var c = Math.log(1);
var d = Math.log(0);
var e = Math.log(-1);
<!--
The result of a,b,c,d, and e will be:
1.0000066849139877
0.6931471805599453
0
-Infinity
NaN
-->Try it Yourself »
❮ JavaScript Math Object