Skip to content

Instantly share code, notes, and snippets.

@julien-sarazin
Last active March 10, 2016 01:13
Show Gist options
  • Save julien-sarazin/572e9730dd662a2a7bec to your computer and use it in GitHub Desktop.
Save julien-sarazin/572e9730dd662a2a7bec to your computer and use it in GitHub Desktop.
Solution for Binary String.
function countPosBits(input){
return isNaN(input) ? 0 : parseInt(input).toString(2).replace(/0/g, '').length;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment