2.1.68 [ECMA-262-1999] Section 15.4.4.6, Array.prototype.pop ()

V0103:

The last element of the array is removed from the array and returned.

(The bulleted steps are added before step 1)

  • __Let O be the result of calling ToObject with the this value as the argument.__

  • __If O is a host object, throw a TypeError exception.__

  1. Call the [[Get]] method of __O__ #this object# with argument "length".

  2. Call ToUint32(Result(1)).

  3. If Result(2) is not zero, go to step 6.

  4. Call the [[Put]] method of __O__ #this object# with arguments "length" and Result(2).

  5. Return undefined.

  6. Call ToString(Result(2)-1).

  7. Call the [[Get]] method of __O__ #this object# with argument Result(6).

  8. Call the [[Delete]] method of __O__ #this object# with argument Result(6).

  9. Call the [[Put]] method of __O__ #this object# with arguments "length" and (Result(2)-1).

  10. __If JScript 5.x under Internet Explorer 7 or 8 and Result(2) > 2147483648, return undefined.__

  11. Return Result(7).

V0104:

NOTE

The pop 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 pop function can be applied successfully to a host object is implementation-dependent.# __JScript 5.x does not allow the pop function to be applied to a host object.__