TheBulgarianWolf

Get Bit At 1st Position

Dec 30th, 2020
905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getBitAt1(number){
  2.     let shiftedNumber = number >> 1;
  3.  
  4.     let result = shiftedNumber & 1;
  5.     console.log(result);
  6. }
  7.  
  8. //Change the number if you want
  9. getBitAt1(5);
Add Comment
Please, Sign In to add comment