Math.log() method is used to return the natural logarithm base E of a number. If the value of the number is negative, the return value is always NaN. If the value of the number is 0 it will return Infinity.
Syntax:
Math.log(x)
Example:
<script> var one = Math.log(5); document.writeln('Output of 5 is : ' + one + '</br></br>'); var two = Math.log(0); document.writeln('Output of 0 is : ' + two + '</br></br>'); var three = Math.log(-1); document.writeln('Output of -1 is : ' + three + '</br></br>'); var four = Math.log(88); document.writeln('Output of 88 is : ' + four + '</br></br>'); </script>
Output:
Output of 5 is : 1.6094379124341003 Output of 0 is : -Infinity Output of -1 is : NaN Output of 88 is : 4.477336814478207