The >>>
bitwise operator is bounded between and including 0 and 2^32-1
(4,294,967,295). By using using >>>
, the framework ensures that the loop does not execute near-infitite times.
PS. The context of the code:
Array.implement({every: function(fn, bind){
for (var i = 0, l = this.length >>> 0; i < l; i++){
if ((i in this) && !fn.call(bind, this[i], i, this)) return false;
}
Since i
is initialised at zero, and incremented by an integer 1, and the length
property is always an integer, there are no negative side-effects. Another application of the >>>
method is rounding, to convert a decimal number to an integer.