|
|
|
The Array prototype object : is %Array.prototype% . is an and has the internal methods specified for such objects. has a "length" property whose initial value is +0 𝔽 and whose attributes are { [[Writable]]: true , [[Enumerable]]: false , [[Configurable]]: false }. has a [[Prototype]] internal slot whose value is NOTE When the concat concat method is called with zero or more arguments, it returns an array containing the array elements of the object followed by the array elements of each argument. The following steps are taken: 1. Let O be ? this value). 2. Let A be ? ( O , 0). 3. Let n be 0. 4. Prepend O to items . 5. For each element E of items , do a. Let spreadable be ? E ). b. If spreadable is true , then i. Let k be 0. ii. Let len be ? ( E ). iii. If n + len > 2 53 - 1, throw a TypeError exception. iv. Repeat, while k < len , 1. Let P be ! k )). 2. Let exists ( E , P ). 3. If exists is true , then a. Let subElement be ? ( E , P ). b. Perform ? ( A , ! ( n )), subElement ). 4. Set n to n + 1. 5. Set k to k + 1. c. Else, i. NOTE: E is added as a single item rather than spread. ii. If n
≥ 2 53 - 1, throw a TypeError exception. iii. Perform ? ( A , ! ( n )), E ). iv. Set n to n + 1. 6. Perform ? ( A , "length" , ( n ), true ). 7. Return A . The "length" property of the concat concat method is 1 𝔽 . The Array prototype object is specified to be an to ensure compatibility with ECMAScript code that was created prior to the ECMAScript 2015 specification. 23.1.3.1 Array.prototype.concat ( ... items ) 637 |