Skip to content

Instantly share code, notes, and snippets.

@cozzbie
Created July 19, 2018 07:07
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 cozzbie/2927c86a89df6058ef020218382e0f35 to your computer and use it in GitHub Desktop.
Save cozzbie/2927c86a89df6058ef020218382e0f35 to your computer and use it in GitHub Desktop.
let convertIntToBase2 = (n, p) => {
p += n % 2;
return n <= 0 ? p.split('').reverse().join('') : convertIntToBase2(parseInt(n / 2), p);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment