This makes it possible to call the function (using call
or apply
) in strict mode on something which isn't an array while following the specification.
If it's an instance of Array
, or an array-like object, it changes nothing.
But here, as this line ensuring list
is an object follows a check that this
is neither null
or undefined
, and as other values wouldn't make the following accesses fail (apart very special cases that Object(this)
wouldn't solve, like failing accessors), I'm not sure there's really a point. Maybe it was set before the check, or maybe it's here just in case of special native objects. Another possibility is that it (too?) strictly follows the specification step by step and wants to apply toObject.
list.length >>> 0
is better than || 0
in the fact it rounds to the nearest lower positive integer (in a 32 bits range). I'm not sure why >>
wasn't used here, as it doesn't seem to be better to iterate until 4294967295 rather than to -1 (i.e. don't lose time).