The Math clz32() static method returns the number of leading zero bits in the 32-bit binary representation of a number.

    
    // 00000000000000000000000000000001
    console.log(Math.clz32(1));
    // 31

    // 00000000000000000000000000000100
    console.log(Math.clz32(4));
    // 29

    // 00000000000000000000001111101000
    console.log(Math.clz32(1000));
    // 22