While exploring the polyfill function for Array.includes
, I stumbled upon the following lines of code:
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 4. Let n be ? ToInteger(fromIndex).
// (If fromIndex is undefined, this step produces the value 0.)
var n = fromIndex | 0;
The purpose behind these lines of code and the reasoning for implementing them in this manner is what intrigues me.