Last active
April 26, 2017 15:03
-
-
Save odesskij/1d7ea6ea9803124941c624ab9e82e320 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fn(number) { | |
return parseInt(number.toString(2).split('').reverse().join(''), 2); | |
} | |
// 1000 -> 0001 (8 -> 1) | |
console.log('fn(8)', fn(8) === 1); | |
// 1100 -> 0011 (12 -> 3) | |
console.log('fn(12)', fn(12) === 3); | |
// 1110 -> 0111 (14 -> 7) | |
console.log('fn(14)', fn(14) === 7); | |
// 1111 -> 1111 (15 -> 15) | |
console.log('fn(15)', fn(15) === 15); | |
// -------------------------------------------------------------------- | |
/* Code #1 */ | |
/* Code #2 */ setTimeout(() => alert('Hello, Code #2'), 1000); | |
/* Code #3 */ | |
// -------------------------------------------------------------------- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment