Default values for specified properties
tc39.github.io/ecma262/#sec-ecmascript-standard-built-in-objects
"Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified."
Brilliant, thanks Allen!
-- T.J. Crowder
I've always felt that made cloning and serializing Error based instances particularly fun.
On Fri, Apr 21, 2017 at 12:11 PM, Michael J. Ryan <tracker1 at gmail.com>
wrote:
I've always felt that made cloning and serializing Error based instances particularly fun.
Well, the one on Error.prototype
is just the ""
default anyway. But
yes, the fact that Error
makes the message
"own" property it
creates non-enumerable is slightly surprising. I'm guessing there's history
there. :-)
-- T.J. Crowder
I always assumed it was an implementation detail historically... stack is also not enumerated, though message is more surprising... I tend to remember for logging/server purposes in particular, and call it out in my clone library, as I've been hit by it many times.
On Apr 21, 2017, at 4:42 AM, Michael J. Ryan <tracker1 at gmail.com <mailto:tracker1 at gmail.com>> wrote:
I always assumed it was an implementation detail historically... stack is also not enumerated, though message is more surprising... I tend to remember for logging/server purposes in particular, and call it out in my clone library, as I've been hit by it many times.
ES1 (1997) Clause 15:
"Every other property described in this section has the attribute { DontEnum } (and no others) unless otherwise specified."
Error.prototype and its properties were added to clause 15 in ES3.
Fairly basic specification comprehension question: Is it correct that the
message
property ofError.prototype
is specified as non-enumerable, because its definition doesn't explicitly say otherwise and so the default properties listed in Table 4 of Property Attributes apply?-- T.J. Crowder