Skip to content

Instantly share code, notes, and snippets.

@orenfromberg
Created August 3, 2018 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orenfromberg/411c9fa0b356643513d9490f752d06f3 to your computer and use it in GitHub Desktop.
Save orenfromberg/411c9fa0b356643513d9490f752d06f3 to your computer and use it in GitHub Desktop.
friday coding challenge one liner
const bin = (number) => Array(64).fill(1).map((val,i) => (2 ** (64 - i - 1)) & number ? 1 : 0).join('').replace(/^0+/g,'')
console.log(bin(14))
console.log(bin(15))
console.log(bin(52359823756))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment