2.9.1.2.4.2 TypeArray.prototype.set(Array [, offset] )

Set multiple values in the TypedArray, reading from the array input., reading input values from the array. The optional offset value indicates the index in the current array where values are written. If omitted, it is assumed to be 0.

  1. If this does not have class "TypeArray", throw a TypeError.

  2. Let offsetIndex be ToUInt32(offset)

  3. Let O be the result of calling ToObject(array).

  4. Let srcLength be the result of calling [[Get]] on O with property name "length".

  5. Let targetLength be the result of calling [[Get]] on this with property name "length"

  6. If srcLength + offset > targetLength, throw a RangeError.

  7. Let temp be a new TypeArray created as if by a call to "new TypeArray(srcLength)"

  8. Let k be 0

  9. While k < srcLength

    1. Let v be the result of calling [[Get]] on src with property name toString(k)

    2. Call [[Put]] on temp with arguments  ToString(k), v, and false

  10. Let k be offset

  11. While k < targetLength

    1. Let v be the result of calling [[Get]] on temp with property name ToString(k-offset)

    2. Call [[Put]] on temp with arguments  ToString(k), v, and false