Created
February 13, 2014 09:08
-
-
Save abrjagad/8972058 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
//Invocation as a constructor | |
//Ninja is a Constructor | |
//should start with Capital letter | |
//creates a emply object{} | |
function Ninja() { | |
this.skulk = function () { | |
return this; | |
}; | |
} | |
// when assigning, use "new" | |
var ninja1 = new Ninja(); | |
var ninja2 = new Ninja(); | |
console.log(ninja1.skulk()) | |
console.log(ninja2.skulk()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment