GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — "constructor" property of function prototype objects does not show up in autocomplete suggestions · Issue #15199 · nodejs/node

"constructor" property of function prototype objects does not show up in autocomplete suggestions #15199

New issue
Copy link
New issue
Copy link
Closed
Closed
"constructor" property of function prototype objects does not show up in autocomplete suggestions#15199
Copy link
Labels
help wantedIssues that need assistance from volunteers or PRs that need help to proceed.utilIssues and PRs related to the built-in util module.

Description

@ghost
ghost
opened on Sep 5, 2017
  • Version: v7.10.0
  • Platform: Linux x1 4.4.0-93-generic test-require-resolve: use case insensitive compare #116-Ubuntu SMP Fri Aug 11 21:17:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Example:

> function f() {}
> f.prototype.
f.prototype.__defineGetter__      f.prototype.__defineSetter__      f.prototype.__lookupGetter__
f.prototype.__lookupSetter__      f.prototype.__proto__             f.prototype.constructor
f.prototype.hasOwnProperty        f.prototype.isPrototypeOf         f.prototype.propertyIsEnumerable
f.prototype.toLocaleString        f.prototype.toString              f.prototype.valueOf

> Object.getOwnPropertyNames(f.prototype);
[ 'constructor' ]

In the example above it only shows the inherited "constructor" property from Object.prototype.

Non-enumerable properties of other objects show up, though.
Example:

> let o = {};
> Object.defineProperty(o, "firstName", {value: "ted"});
> o.
o.__defineGetter__      o.__defineSetter__      o.__lookupGetter__      o.__lookupSetter__
o.__proto__             o.constructor           o.hasOwnProperty        o.isPrototypeOf
o.propertyIsEnumerable  o.toLocaleString        o.toString              o.valueOf

o.firstName

Activity

  1. TimothyGu commented on Sep 5, 2017

    @TimothyGu
    TimothyGu
    on Sep 5, 2017
    Member
    More actions

    The constructor property you are seeing is an own property of f.prototype that points to f itself.

  2. targos commented on Sep 5, 2017

    @targos
    targos
    on Sep 5, 2017
    Member
    More actions

    This is a more general issue. Take this example:

    var x = Object.create(null);
    x.a = 1;
    x.b = 2;
    var y = Object.create(x);
    y.a = 3;
    y.c = 4;

    Completion for y.<tab><tab>:

    > y.
    y.a  y.b  
    
    y.c  
    

    I would also expect y.a to be next to y.c because the own property shadows the property on the prototype.

  3. targos commented on Sep 5, 2017

    @targos
    targos
    on Sep 5, 2017
    Member
    More actions

    @pretodor Not at all. I think it's a valid issue.

  4. mscdex
    added
    utilIssues and PRs related to the built-in util module.
    on Sep 5, 2017
  5. apapirovski
    added
    help wantedIssues that need assistance from volunteers or PRs that need help to proceed.
    on Apr 13, 2018
  6. rubys
    added a commit that references this issue on Jun 29, 2018

    repl: make own properties shadow prototype properties

    d4d9b20
  7. addaleax
    closed this as completedin 4d42083on Jul 13, 2018
  8. targos
    added a commit that references this issue on Jul 14, 2018

    repl: make own properties shadow prototype properties

    4b613d3
  9. sjarmak
    added a commit that references this issue on Jul 27, 2026

    repl: make own properties shadow prototype properties

    4d42083
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedIssues that need assistance from volunteers or PRs that need help to proceed.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.