Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. //Object definition
  2. function Apple(type) {
  3. this.color = "red";
  4. this.getInfo = function() {
  5. console.log("Called getInfo() from inside Apple - original");
  6. }
  7. }
  8.  
  9. //over write getInfo() -- dosn't work
  10. Apple.prototype.getInfo = function() {
  11. console.log("Apple getInfo called - prototype override");
  12. };
  13.  
  14. a = new Apple();
  15. a.getInfo();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement