Checks if the given number is a power of 2
.
&
) to determine if n
is a power of 2
.n
is not falsy.const isPowerOfTwo = n => !!n && (n & (n - 1)) == 0;
isPowerOfTwo(0); // false
isPowerOfTwo(1); // true
isPowerOfTwo(8); // true
JavaScript, Math
Checks if the given number is a power of 10
.
JavaScript, Math
Returns the powerset of a given array of numbers.
JavaScript, Math
Checks if the given value is a number.