The "name" and "length" property of JSON.parse and JSON.stringify

程劭非 csf178 at gmail.com
Mon Mar 12 01:08:04 PDT 2012


Thank you. It's my fault that I didn't read it carefully.

2012/3/12 Lasse Reichstein <reichsteinatwork at gmail.com>

> On Mon, Mar 12, 2012 at 8:33 AM, 程劭非 <csf178 at gmail.com> wrote:
> > Hi all,
> > Just noticed that there is no description about "name" and "length"
> property
> > of JSON.parse and JSON.stringify in ES5.
> > Are they implement-dependent?
> >
> > (I saw test262 require JSON.stringify.length to be 3, but no such case
> > for JSON.parse. )
>
> The first part of section 15 says:
> "Every built-in Function object described in this clause―whether as a
> constructor, an ordinary function, or both―has a length property whose
> value is an integer. Unless otherwise specified, this value is equal
> to the largest number of named arguments shown in the subclause
> headings for the function description, including optional parameters."
>
> I.e., the lengths are specified.
> I don't believe the name properties for function objects are specified
> anywhere in ES5, so they are entirely outside the spec.
>
> /L
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120312/0f3d8f0c/attachment.html>


More information about the es-discuss mailing list