Math.log()
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.log()
정적 메서드는 숫자의 자연 로그(밑이 e)를 반환합니다. 즉, 아래와 같습니다.
시도해 보기
function getBaseLog(x, y) {
return Math.log(y) / Math.log(x);
}
// 2 x 2 x 2 = 8
console.log(getBaseLog(2, 8));
// Expected output: 3
// 5 x 5 x 5 x 5 = 625
console.log(getBaseLog(5, 625));
// Expected output: 4
구문
js
Math.log(x)
매개변수
x
-
0 이상의 수