2.1.66 [ECMA-262-1999] Section 15.4.4.4, Array.prototype.concat ( [ item1 [ , item2 [ , … ] ] ] )

When the concat method is called with zero or more arguments item1, item2, etc., it returns an array containing the array elements of the object followed by the array elements of each argument in order.

The following steps are taken:

  1. Let A be a new array created as if by the expression new Array().

  2. Let n be 0.

    1. __Let biasN = 0.__

  3. Let E be this object.

  4. If E is not an Array object, go to step 16.

  5. Let k be 0.

    1. __Let biasK = 0.__

  6. Call the [[Get]] method of E with argument "length".

  7. If k equals Result(6) go to step 19.

  8. Call ToString(k__-biasK__).

  9. If E has a property named by Result(8), go to step 10, but if E has no property named by Result(8), go to step 13.

  10. Call ToString(n__-biasN__).

  11. Call the [[Get]] method of E with argument Result(8).

  12. Call the [[Put]] method of A with arguments Result(10) and Result(11).

  13. Increase n by 1.

    1. __If n > 2147483647, then let biasN = 4294967296; else let biasN = 0.__

  14. Increase k by 1.

    1. __If k > 2147483647, then let biasK = 4294967296; else let biasK = 0.__

  15. Go to step 7.

  16. Call ToString(n__-biasN__).

  17. Call the [[Put]] method of A with arguments Result(16) and E.

  18. Increase n by 1.

    1. __If n > 2147483647, then let biasN = 4294967296; else let biasN = 0.__

  19. Get the next argument in the argument list; if there are no more arguments, go to step 22.

  20. Let E be Result(19).

  21. Go to step 4.

  22. Call the [[Put]] method of A with arguments "length" and n.

  23. Return A.

The length property of the concat method is 1.

As specified above in step 3, JScript 5.x uses the passed this value without applying a ToObject coercion to it. If this method is called using the JScript 5.x implementations of the Function.prototype.call or Function.prototype.apply methods and passing either null or undefined as the this argument, the global object is not used as the this value. If a Number, String, or Boolean value is passed as the this argument the passed value rather than a corresponding wrapper object is used as the this value.

V0100:

NOTE

The concat function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the concat function can be applied successfully to a host object is implementation-dependent.

In JScript 5.x the concat function handles array index property names with numeric values greater than 231-1 differently from numerically smaller array index property names. As this behavior differs from the base specification and from the probable user intent the use of this function on objects containing such properties should be avoided.