var isPowerOfTwo = function(n) {
if (typeof n !== 'number')
return 'Not a number';

return n && (n & (n - 1)) === 0;

}

console.log(isPowerOfTwo(16));
console.log(isPowerOfTwo(18));
console.log(isPowerOfTwo(256));