
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Calculate Natural Logarithm of a Number in JavaScript
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> <head> <title>JavaScript Math log() Method</title> </head> <body> <script> var value = Math.log(2); document.write("Value : " + value ); </script> </body> </html>
Advertisements