Last active
November 19, 2015 16:25
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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