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인 로그를 반환합니다. 아래와 같습니다.

x>0,𝙼𝚊𝚝𝚑.𝚕𝚘𝚐𝟷𝟶(𝚡)=log10(x)=the unique y such that 10y=x\forall x > 0,;\mathtt{\operatorname{Math.log10}(x)} = \log_{10}(x) = \text{the unique } y \text{ such that } 10^y = x

시도해보기

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 GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
log10

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

같이 보기