Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
es7 `new` fix
class Point2D {
.constructor(x, y) { this.x = x, this.y = y; }
.[Symbol.call](x, y) { return new this.constructor(x, y); }
//...
}
@ericelliott

This comment has been minimized.

Copy link
Owner Author

commented Mar 6, 2015

Example by Brendan Eich.

See How to Fix the ES6 class Keyword for context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.