The Math log2() static method returns the base 2 logarithm of a number.

    
    console.log(Math.log2(3));
    // 1.584962500721156

    console.log(Math.log2(2));
    // 1

    console.log(Math.log2(1));
    // 0

    console.log(Math.log2(0));
    // -Infinity