Created
November 15, 2016 11:42
-
-
Save berewt/434d474cc61089d35ff9a34f99d8e352 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$ node --version | |
v6.9.1 | |
$ node | |
> bar = {MyClass: function (x) {this.x = x}} | |
{ MyClass: [Function: MyClass] } | |
> foo = {MyClass(x) {this.x = x}} | |
{ MyClass: [Function: MyClass] } | |
> new bar.MyClass(2) | |
MyClass { x: 2 } | |
> new foo.MyClass(2) | |
TypeError: foo.MyClass is not a constructor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment