How do arguments objects print?

Allen Wirfs-Brock Allen.Wirfs-Brock at
Sat Feb 28 10:25:19 PST 2009

Here is what I propose for Array.prototype.toString (minus the formatting):	Array.prototype.toString ( )
When the toString method is called, the following steps are taken:
1.	Let array be the result of calling ToObject on the this value.
2.	Let func be the result of calling the [[Get]] internal method of array with argument "join".
3.	If IsCallable(func) is false, then let func be the standard built-in method Object.prototype.toString (
4.	Return  the result of calling the [[Call]] internal method of func providing array as the this value and an empty arguments list.
The toString 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 toString function can be applied successfully to a host object is implementation-dependent.

More information about the Es-discuss mailing list