JavaScript Math log() methodLast Updated : 17 Mar 2025 The JavaScript math log() method returns the natural logarithm of the given number i.e. base e. If the number is negative, it returns NaN. SyntaxThe log() method is represented by the following syntax: Parameternum - A number. ReturnThe natural logarithm of a number. JavaScript Math log() method exampleHere, we will understand log() method through various examples. Example 1Let's see an example to print the natural logarithm of a number. Output: 0 1.6094379124341003 2.302585092994046 Example 2Let's see the result of log() method in different test cases. Output: NaN NaN -Infinity Example 3Here, you can test log() method with your own test cases. Next TopicJavaScript Math |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India