log()

The log9)method is used to calculate the natural logarithm of a number, the base of which is E, Euler's Constant. As with all mathematical methods, it is used with a Math object.

syntax:

Math.log(number)

EXAMPLE

var newNumber = 34;

document.write("The natural logarithm of 34 is : " + Math.log(newNumber) )

The example begins with the creation of newNumber, which holds the value of 34. A document.write statement then writes some applicable text to the screen with the product of using the log() method on newNumber. The output is as follows:



The natural logarithm of 34 is : 3.5263605246161615