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์ธ ๋ก๊ทธ๋ฅผ ๋ฐํํฉ๋๋ค. ์๋์ ๊ฐ์ต๋๋ค.
์๋ํด ๋ณด๊ธฐ
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ยฎ 2026 Language Specification # sec-math.log10 |
๋ธ๋ผ์ฐ์ ํธํ์ฑ
Loadingโฆ