Created
January 15, 2015 16:49
-
-
Save nuysoft/16c4d3f36a38e98b6e4e to your computer and use it in GitHub Desktop.
解析倍增数
This file contains 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 parse(result) { | |
var cursor = 1, | |
arr = [] | |
while (cursor <= result) { | |
if (result & cursor) arr.push(cursor) | |
cursor *= 2 | |
} | |
console.log(arr) | |
} | |
for (var i = 0; i < 100; i++) { | |
parse(i) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment