JavaScript Math LN10
Syntax & Examples


Math.LN10 static-property

The Math.LN10 property represents the natural logarithm of 10, which is approximately equal to 2.303.


Syntax of Math.LN10

The syntax of Math.LN10 static-property is:

Math.LN10

This LN10 static-property of Math natural logarithm of 10; approximately 2.303.



✐ Examples

1 Using Math.LN10 to calculate logarithm values

In JavaScript, we can use the Math.LN10 property to assist in logarithm calculations.

For example,

  1. We create a variable logValue and set it to Math.LN10.
  2. We log logValue to the console using the console.log() method.

JavaScript Program

const logValue = Math.LN10;
console.log(logValue);

Output

2.302585092994046

2 Using Math.LN10 in a logarithmic expression

In JavaScript, we can use the Math.LN10 property in logarithmic expressions.

For example,

  1. We create a variable x and set it to 10.
  2. We calculate the natural logarithm of x divided by Math.LN10 using the Math.log() method.
  3. The result is stored in the variable result.
  4. We log result to the console using the console.log() method.

JavaScript Program

const x = 10;
const result = Math.log(x) / Math.LN10;
console.log(result);

Output

1

3 Using Math.LN10 in a mathematical formula

In JavaScript, we can use the Math.LN10 property in various mathematical formulas.

For example,

  1. We create variables a and b representing two numbers.
  2. We calculate the natural logarithm of the product of a and b using the formula Math.log(a * b) / Math.LN10.
  3. The result is stored in the variable logResult.
  4. We log logResult to the console using the console.log() method.

JavaScript Program

const a = 2;
const b = 5;
const logResult = Math.log(a * b) / Math.LN10;
console.log(logResult);

Output

1

Summary

In this JavaScript tutorial, we learned about LN10 static-property of Math: the syntax and few working examples with output and detailed explanation for each example.