Skip to content

Instantly share code, notes, and snippets.

@qubyte
Last active November 19, 2015 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qubyte/c696752b216f850c55cd to your computer and use it in GitHub Desktop.
Save qubyte/c696752b216f850c55cd to your computer and use it in GitHub Desktop.
In Node.js 4.2.2 and Chrome 47 (probably other versions too) object shorthands cannot be used as constructors.
const test1 = {
MyConstructor: function () {}
};
new test1.MyConstructor(); // fine
const test2 = {
MyConstructor() {}
};
new test2.MyConstructor(); // TypeError: MyConstructor() {} is not a constructor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment