7 lines
195 B
JavaScript
7 lines
195 B
JavaScript
|
function isPower_of_two(num)
|
||
|
{
|
||
|
return num && (num & (num - 1)) === 0;
|
||
|
}
|
||
|
|
||
|
console.log(isPower_of_two(64));
|
||
|
console.log(isPower_of_two(94));
|