Advertisement
kstoyanov

03. Extend Prototype

Oct 15th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function extendClass(classToExtend) {
  2.  
  3.   classToExtend.prototype.species = 'Human';
  4.   classToExtend.prototype.toSpeciesString = function () {
  5.       return `I am a ${this.species}. ${this.toString()}`;
  6.   }
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement