Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1.  
  2. function Base () { }
  3.  
  4. Base.prototype.doWork = function () {
  5. console.log(this.name);
  6. }
  7.  
  8. function Sub () {
  9. this.name = 'brian'
  10. }
  11.  
  12. Sub.prototype = Object.create(Base.prototype);
  13. Sub.prototype.constructor = Sub;
  14.  
  15. var sub = new Sub();
  16. sub.doWork();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement