Last active
May 27, 2017 18:04
-
-
Save jhwheeler/41e36c47dee8a3feb5305220b0d7c188 to your computer and use it in GitHub Desktop.
Binary and Bitwise Drills
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
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