Skip to content

Instantly share code, notes, and snippets.

@jhwheeler
Last active May 27, 2017 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhwheeler/41e36c47dee8a3feb5305220b0d7c188 to your computer and use it in GitHub Desktop.
Save jhwheeler/41e36c47dee8a3feb5305220b0d7c188 to your computer and use it in GitHub Desktop.
Binary and Bitwise Drills
const num = parseInt(process.argv[2], 10);
const newBit = parseInt(process.argv[3], 2);
const thirdBit = num => {
const binNum = num.toString(2);
const binNumArr = binNum.split('');
binNumArr.splice(2, 1, newBit);
console.log(binNumArr);
return binNumArr
}
thirdBit(num);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment