What good does zero-fill bit-shifting by 0 do? (a >>> 0)

JavascriptBitwise Operators

Javascript Problem Overview


I just came across this piece in the Mozilla Javascript documentation:

var len = this.length >>> 0;  

I don't quite understand why this is being done. What good does zero-fill right shifting this.length by 0 do? As far as I understand, it does exactly nothing. Is it to safely establish a default value for len, even if this.length is not an integer? Can this ever feasibly be the case? If so, what's the difference between >> 0 and >>> 0?

Javascript Solutions


Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondecezeView Question on Stackoverflow