Skip to content

Instantly share code, notes, and snippets.

@eighteyes
Created April 13, 2017 21:29
Show Gist options
  • Save eighteyes/214a0c358105c770f158d6bb6b17aa60 to your computer and use it in GitHub Desktop.
Save eighteyes/214a0c358105c770f158d6bb6b17aa60 to your computer and use it in GitHub Desktop.
new es constructor gotcha
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