Last active
December 20, 2015 07:49
-
-
Save Protonk/6096105 to your computer and use it in GitHub Desktop.
For Jory
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 intAdd(arr) { | |
var out; | |
out = arr.reduce(function(l, r) { | |
return l + r; | |
}); | |
return out.toString(2); | |
} | |
intAdd([1,2,3]) | |
// "110" | |
parseInt(intAdd([1,2,3]), 2) | |
// 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment