Skip to content

Instantly share code, notes, and snippets.

@misterpoloy
Created May 27, 2020 04:45
Show Gist options
  • Save misterpoloy/56fd9e9abcc9b5a7d6d2417f94699dc9 to your computer and use it in GitHub Desktop.
Save misterpoloy/56fd9e9abcc9b5a7d6d2417f94699dc9 to your computer and use it in GitHub Desktop.
#CodeChallenge Bitwise Operator
const getBinaryDigit = (target, bytes = 31) => {
let result = "";
for(let i = 0; i < bytes; i++) {
const condition = target & (1 << i);
if (condition != 0) {
result = 1 + result;
} else {
result = 0 + result;
}
}
console.log(result);
}
getBinaryDigit(5);
@misterpoloy
Copy link
Author

Bitwise operatinos xor

Bitwise Shift

bitwise what can we do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment