Created
July 1, 2017 03:53
-
-
Save sghiassy/93589e34307f7f3156c319d242a50842 to your computer and use it in GitHub Desktop.
JavaScript utility function to output full 32 bit representations of binary digits
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 dec2bin(dec){ | |
var str = (dec >>> 0).toString(2); | |
return (str.length < 32) ? Array(32 - str.length).fill(0).join('').concat(str) : str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment