Skip to content

Instantly share code, notes, and snippets.

@sghiassy
Created July 1, 2017 03:53
Show Gist options
  • Save sghiassy/93589e34307f7f3156c319d242a50842 to your computer and use it in GitHub Desktop.
Save sghiassy/93589e34307f7f3156c319d242a50842 to your computer and use it in GitHub Desktop.
JavaScript utility function to output full 32 bit representations of binary digits
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