0

I found this code on W3schools for converting decimal into binary.

function dec2bin(dec){
return (dec >>> 0).toString(2);
}

I don't understand what is the purpose for making zero fill right shift in this case? What is the use of setting the shift to 0 (i.e. dec >>> 0) since as I know it doesn't push any binary digit to the right at all?

I am a JS beginner. Thanks!

Wilson Lau
  • 21
  • 2

0 Answers0