JavaScript log10() Method
More "Try it Yourself" examples below.
Definition and Usage
The log10() method returns the base-10 logarithm of a number.
Browser Support
Method | |||||
---|---|---|---|---|---|
log10() | 38.0 | 12.0 | 25.0 | 8.0 | 25.0 |
Syntax
Math.log10(x)
Parameter Values
Parameter | Description |
---|---|
x | Required. A number |
Technical Details
Return Value: | A Number, representing the base-10 logarithm of a number If the number is negative, NaN is returned If the number is 0, -Infinity is returned |
---|---|
JavaScript Version: | ECMAScript 2015 |
More Examples
Example
Use the log10() method on different numbers:
var a = Math.log10(2.7183);
var b = Math.log10(2);
var c = Math.log10(1);
var d = Math.log10(0);
var e = Math.log10(-1);
Try it Yourself »