```
/**
* @param {number} n
* @return {boolean}
*/
var isPowerOfTwo = function(n) {
return n<=0 ? false : !(n&(n-1));
};
```

```
/**
* @param {number} n
* @return {boolean}
*/
var isPowerOfTwo = function(n) {
while(!(n&1) && n > 0) n = n>>>1;
return n === 1 ? true : false;
};
```