Math.log() function compute a natural logarithm. The method returns the natural logarithm (base E) of a number if the value of number is negative, the return value is always NaN or If the number is 0, the function returns -Infinity.
Syntax
Math.log( x ) ;
x is a numbers.
For Example
var value = Math.log(10);
document.write("First Test Value : " + value );
var value = Math.log(0);
document.write("<br />Second Test Value : " + value );
var value = Math.log(-1);
document.write("<br />Third Test Value : " + value );
var value = Math.log(100);
document.write("<br />Fourth Test Value : " + value );
The output for this
First Test Value : 2.302585092994046
Second Test Value : -Infinity
Third Test Value : NaN
Fourth Test Value : 4.605170185988092
0 Comment(s)