Created
October 30, 2013 21:04
-
-
Save jgatjens/7240250 to your computer and use it in GitHub Desktop.
Prototypal Inheritance
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
var BaseModel = function(type){ | |
this.type = !type ? "BaseModel" : type ; | |
}; | |
BaseModel.prototype.sayHello = function() { | |
return "Hello " + this.type; | |
}; | |
var User = function() { | |
BaseModel.call(this); | |
}; | |
User.prototype = Object.create(BaseModel.prototype); | |
var model = new User(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment