0

The ECMAScript spec says constructor function instances have following properties:

But in the browser, I can see that a function instance has two additional properties:

  • .arguments, and
  • .caller

The only reference I could find to these properties in the spec was here.

Why are these additional properties present?

Ben Aston
  • 53,718
  • 65
  • 205
  • 331

1 Answers1

0

These non-standard properties are added to normal (ie. non-arrow, non-method, non-async, non-generator etc) function instances in non-strict mode, for legacy compatibility reasons.

It appears that the .arguments property was superseded by the implicit arguments variable (which is still part of the specification).

Note that the object pointed to by the implicit arguments variable also used to contain a .caller property, but this was dropped in ES2017.

More info here and here and here.

MDN for function.arguments and function.caller.

Ben Aston
  • 53,718
  • 65
  • 205
  • 331