Skip to content

Instantly share code, notes, and snippets.

@orenfromberg
Created Aug 3, 2018
Embed
What would you like to do?
friday coding challenge
const bin = (number) => {
let answer = '';
for (let i = 0; i < 64; i++) {
answer = `${number & (2 ** i)? 1 : 0}${answer}`;
}
return answer.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