Languages
[Edit]
EN

JavaScript - Math.ln() method example

9 points
Created by:
p_agon
409

There is no Math.ln() method in JavaScript.

The Math.log() method is used to calculate the natural logarithm.

Quick solution:

// ONLINE-RUNNER:browser;

// Natural logarithm (logarithm with base e):
//                     x            y
console.log( Math.log( 1    ) ); // 0                  <--- ln(1)
console.log( Math.log( 7    ) ); // 1.9459101490553132 <--- ln(7)
console.log( Math.log( 10   ) ); // 2.3025850929940460 <--- ln(10)
console.log( Math.log( 100  ) ); // 4.6051701859880920 <--- ln(100)
console.log( Math.log( 1000 ) ); // 6.9077552789821370 <--- ln(1000)

console.log( Math.log( -1        ) ); //  NaN          <--- ln(-1)
console.log( Math.log(  0        ) ); // -Infinity     <--- ln(0)
console.log( Math.log( +Infinity ) ); // +Infinity     <--- ln(+Infinity)

console.log( Math.E ); // 2.718281828459045            <--- ln(e)

References

  1. JavaScript - Math.log() - Dirask Docs 

JavaScript - math (popular problems)

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join