Created
April 13, 2017 21:29
-
-
Save eighteyes/214a0c358105c770f158d6bb6b17aa60 to your computer and use it in GitHub Desktop.
new es constructor gotcha
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
var es5 = function(){ return this; } | |
var es6 = () => { return this; } | |
var a = new es5(); | |
// no error | |
var b = new es6(); | |
// TypeError: es6 is not a constructor | |
// I enjoy the other way of declaring constructors that is less classy. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment