Math.log2

Returns the base 2 logarithm of a number.

Syntax

log2(value)

Parameters

Return value

A number.

Examples

Math.log2(128)
7
2 ** Math.log2(256)
256