How to get Natural logarithm of 10 in JavaScript?

To get the natural logarithm of 10 in JavaScript, use the Math.LN10 property. This built-in constant returns the natural logarithm of 10, which is approximately 2.302585092994046.

Syntax

Math.LN10

Return Value

Returns a number representing the natural logarithm of 10 (ln(10) ? 2.302585092994046).

Example

<html>
    <head>
        <title>JavaScript Math LN10 Property</title>
    </head>
    <body>
        <script>
            var propertyValue = Math.LN10;
            document.write("Natural logarithm of 10: " + propertyValue);
        </script>
    </body>
</html>

Output

Natural logarithm of 10: 2.302585092994046

Using with Console

You can also use Math.LN10 in console-based JavaScript environments:

console.log("Math.LN10:", Math.LN10);
console.log("Rounded to 3 decimals:", Math.round(Math.LN10 * 1000) / 1000);
Math.LN10: 2.302585092994046
Rounded to 3 decimals: 2.303

Common Use Cases

Math.LN10 is useful in scientific calculations, logarithmic transformations, and mathematical formulas that require the natural logarithm of 10 as a constant value.

Conclusion

Math.LN10 provides a precise constant for the natural logarithm of 10. It's more accurate than calculating Math.log(10) and is the standard way to access this mathematical constant in JavaScript.

Updated on: 2026-03-15T23:18:59+05:30

717 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements