Skip to content

Instantly share code, notes, and snippets.

@ericelliott
Created March 6, 2015 00:46
Show Gist options
  • Save ericelliott/1c6f451b2ed1b634c2f2 to your computer and use it in GitHub Desktop.
Save ericelliott/1c6f451b2ed1b634c2f2 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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