Skip to content

Properties of Function vs. Function.prototype #18188

@js-choi

Description

@js-choi

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name

What specific section or headline is this issue about?

Article title

What information was incorrect, unhelpful, or incomplete?

The properties of Function instances (length and name, and I guess the deprecated/nonstandard arguments, caller, and displayName) are named as properties of the Function constructor (e.g., Function.length). While it is true that, as a Function itself, the Function constructor has constant length and name properties, they are also present on all Function instances.

I think it is misleading to title these properties as Function.length, etc.—this naming implies that they are present only on the Function constructor rather than Function intsances. It is also inconsistent with how other objects treat their instance properties—e.g., Array.prototype.length.

What did you expect to see?

I expected to see these properties titled Function.prototype.length, Function.prototype.name, etc. Although length and name are not strictly speaking inherited from Function.prototype, this situation is little different from “exotic” properties on exotic objects, such as Array.prototype.length. It’s less misleading to distinguish them as instance objects using Function.prototype.

Do you have any supporting links, references, or citations?

Links to sections in Ecma262 are given above.

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions