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 July 2015.
Math.log10()
정적 메서드는 숫자의 밑이 기본 10인 로그를 반환합니다. 아래와 같습니다.
시도해보기
console.log(Math.log10(100000));
// Expected output: 5
console.log(Math.log10(2));
// Expected output: 0.3010299956639812
console.log(Math.log10(1));
// Expected output: 0
console.log(Math.log10(0));
// Expected output: -Infinity
구문
js
Math.log10(x)
매개변수
x
-
0보다 크거나 같은 숫자입니다.
반환 값
x
의 밑이 기본 10인 로그. x < 0
이면 NaN
를 반환합니다.
설명
log10()
이 Math
의 정적 메서드이기 때문에 생성한 Math
객체의 메서드가 아닌 항상 Math.log10()
로 사용합니다 (Math
는 생성자가 아닙니다).
이 함수는 Math.log(x) / Math.log(10)
와 동일합니다. log(e)
의 경우, 1 / Math.LN10
인 상수 Math.LOG10E
를 사용합니다.
예제
Math.log10() 사용
js
Math.log10(-2); // NaN
Math.log10(-0); // -Infinity
Math.log10(0); // -Infinity
Math.log10(1); // 0
Math.log10(2); // 0.3010299956639812
Math.log10(100000); // 5
Math.log10(Infinity); // Infinity
명세서
Specification |
---|
ECMAScript® 2025 Language Specification # sec-math.log10 |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
log10 |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.