Movatterモバイル変換


[0]ホーム

URL:


  1. 面向开发者的 Web 技术
  2. JavaScript
  3. JavaScript 参考
  4. JavaScript 标准内置对象
  5. Math
  6. Math.log10()

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in EnglishAlways switch to English

Math.log10()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.

Math.log10() 函数返回一个数字以 10 为底的对数。

语法

Math.log10(x)

参数

x

任意数字。

描述

如果传入的参数小于 0,则返回 NaN.

示例

js
Math.log10(10); // 1Math.log10(100); // 2Math.log10("100"); // 2Math.log10(1); // 0Math.log10(0); // -InfinityMath.log10(-2); // NaNMath.log10("foo"); // NaN

规范

Specification
ECMAScript® 2026 Language Specification
# sec-math.log10

浏览器兼容性

参见

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp