Skip to content

Instantly share code, notes, and snippets.

@vlad-bezden
Created March 9, 2017 03:03
Show Gist options
  • Save vlad-bezden/dbc1b95eab24de3259a0f619daa32c1e to your computer and use it in GitHub Desktop.
Save vlad-bezden/dbc1b95eab24de3259a0f619daa32c1e to your computer and use it in GitHub Desktop.
IsPowerOfTwo
console.clear()
const isPowerOfTwo = x => Number.isInteger(Math.log2(x));
[...Array(10)].forEach((_, x) => console.log(x, isPowerOfTwo(x)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment