Created
May 20, 2015 22:46
-
-
Save allanesquina/50934195d36d0e22bd2e to your computer and use it in GitHub Desktop.
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
// Object construcion exemple | |
function MyClass() { | |
this.myProperty = 'foo'; | |
} | |
// Whitout new | |
var myInstance = {}; | |
MyClass.call( myInstance ); | |
console.log( 'without ' + myInstance.myProperty ); | |
// Whit new | |
var myInstance = new MyClass(); | |
console.log( 'with: ' + myInstance.myProperty ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment