📦 Archived documentation: r1 (committed 2026-10-07) View current documentation →

Math.log()

Math.log(x) → number

Returns the natural logarithm (base e) of x.

Returns the natural logarithm (㏑) of x. Returns -Infinity for 0 and NaN for negative values.

Arguments

NameTypeRequiredDefaultDescription
x number optional — A number greater than or equal to 0.

Returns

number The natural logarithm of x.

Example

let l = Math.log(Math.E); // 1