W https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/fillnie mam pojęcia przedmiot (ten) oznacza
istnieje linia jak
// Steps 1-2.
if (this == null) {
throw new TypeError('this is null or not defined');
}
var O = Object(this); // <- WHAT IS THIS???????????
// Steps 3-5.
var len = O.length >>> 0;
// Steps 6-7.
var start = arguments[1];
var relativeStart = start >> 0;
// Step 8.
var k = relativeStart < 0 ?
Math.max(len + relativeStart, 0) :
Math.min(relativeStart, len);
// Steps 9-10.
var end = arguments[2];
var relativeEnd = end === undefined ?
len : end >> 0;
// Step 11.
var final = relativeEnd < 0 ?
Math.max(len + relativeEnd, 0) :
Math.min(relativeEnd, len);
// Step 12.
while (k < final) {
O[k] = value;
k++;
}
// Step 13.
return O;
i nie mogę znaleźć żadnego konieczność przypisania O jako przedmiot (ten).
Czy jest napisane tylko dla czytelności, czy jest jakiś konkretny powód przydziału?
Cóż, postępuje zgodnie z instrukcjami algorytmu podanymi w specyfikacji. I tam mówi: "Niech się stanie? ToObject (ta wartość). "Http://www.ecma-international.org/ecma-262/7.0/#sec-array.prototype.fill –