Edit: This question is out of date as the Polyfill example has been updated. I\'m leaving the question here just for reference. Read the correct answer for usef
The result is, indeed, converted back to a number, i.e., a 64-bit precision floating point number. However, before it is converted back, both operands are converted to UInt32
, then the right shift operation is performed. This is specified in ECMAScript here:
http://www.ecma-international.org/ecma-262/5.1/#sec-11.7.3
The net result of length >>> 0
is therefore, because >>> 0
itself is a no-op, to convert length
to a UInt32
then back to a double. What is it good for? It forces the loss of precision, and effectively forces the value to be 1) and integer and 2) in the range [0, 2^32-1]. For example, if it was -1, it will become 2^32-1 == 4294967295. If it was, 3.6, it will become 3.