--- title: Math.log10() slug: Web/JavaScript/Reference/Global_Objects/Math/log10 translation_of: Web/JavaScript/Reference/Global_Objects/Math/log10 ---
Math.log10() 函数返回一个数字以 10 为底的对数.
Math.log10(x)
x如果传入的参数小于 0, 则返回 NaN.
Math.log10(10)   // 1
Math.log10(100)  // 2
Math.log10("100")// 2
Math.log10(1)    // 0
Math.log10(0)    // -Infinity
Math.log10(-2)   // NaN
Math.log10("foo")// NaN
| Specification | Status | Comment | 
|---|---|---|
| {{SpecName('ES6', '#sec-math.log10', 'Math.log10')}} | {{Spec2('ES6')}} | Initial definition. | 
{{ CompatibilityTable() }}
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari | 
|---|---|---|---|---|---|
| Basic support | {{CompatNo}} | {{CompatGeckoDesktop("25")}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | 
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | 
|---|---|---|---|---|---|---|
| Basic support | {{CompatNo}} | {{CompatNo}} | {{CompatGeckoMobile("25")}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |