Created
December 8, 2014 19:26
-
-
Save devdays/1fb2c32fe290a00f99e8 to your computer and use it in GitHub Desktop.
Object JavaScript - this when using a new operator
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
function MyType() { | |
this.someData = "a string"; | |
} | |
var instance = new MyType(); | |
// Kind of like the following, but there are more steps involved: | |
// var instance = {}; | |
// MyType.call(instance); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment