Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly keep p.constructor == Point #11

Closed
deanm opened this issue Nov 9, 2017 · 1 comment
Closed

Properly keep p.constructor == Point #11

deanm opened this issue Nov 9, 2017 · 1 comment
Labels

Comments

@deanm
Copy link

deanm commented Nov 9, 2017

For the default prototype on a function you have f.prototype.constructor = f. However, in this code the entire prototype is reassigned to an object literal:

Point.prototype = {

This means:

new Point(1, 1).constructor === Point
false

new Point(1, 1).constructor === { }.constructor
true

It should be enough to add a constructor: Point into the object literal.

@mourner mourner added the bug label Jul 10, 2024
@mourner
Copy link
Member

mourner commented Jul 10, 2024

Fixed in 1d80440

@mourner mourner closed this as completed Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants