Answers for "javascript check if number is a power of 2"

0

javascript check if number is a power of 2

function powerOfTwo(x) {
    return Math.log2(x) % 1 === 0;
}
Posted by: Guest on September-05-2021

Code answers related to "javascript check if number is a power of 2"

Code answers related to "Javascript"

Browse Popular Code Answers by Language