Start of main content## More like this

Checks if the given number is a power of `2`

.

- Use the bitwise binary AND operator (
`&`

) to determine if`n`

is a power of`2`

. - Additionally, check that
`n`

is not falsy.

`const isPowerOfTwo = n => !!n && (n & (n - 1)) == 0;`

```
isPowerOfTwo(0); // false
isPowerOfTwo(1); // true
isPowerOfTwo(8); // true
```

### Number is power of ten

JavaScript, Math

Checks if the given number is a power of

`10`

.### Powerset

JavaScript, Math

Returns the powerset of a given array of numbers.

### Validate number

JavaScript, Math

Checks if the given value is a number.