Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Object definition
- function Apple(type) {
- this.color = "red";
- this.getInfo = function() {
- console.log("Called getInfo() from inside Apple - original");
- }
- }
- //over write getInfo() -- dosn't work
- Apple.prototype.getInfo = function() {
- console.log("Apple getInfo called - prototype override");
- };
- a = new Apple();
- a.getInfo();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement