How to calculate the ln of a given number in JavaScript?

JavascriptWeb DevelopmentFront End Technology

To calculate the ln of a given number, use the Math.log() method in JavaScript. This method returns the natural logarithm (base E) of a number. If the value of a number is negative, the return value is always NaN.

Example

You can try to run the following code to get the ln of a given number −

<html>
</html>