Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Maria Dan
Added: May 12, 2021 4:42 PM
Views: 502
Tags: no tags
  1. var Human = function(name){
  2.    this.name = typeof name == 'undefined' ? 'noname' : name;
  3.    this.go = function (){
  4.       console.log('i`m going');
  5.    }
  6. }
  7.  
  8. let Boy = function (beard) {
  9.   this.gender = "boy"
  10.   this.beard = beard
  11. }
  12.  
  13. let Girl = function (longHair) {
  14.   this.gender = "girl"
  15.   this.longHair = longHair
  16. }
  17.  
  18. Boy.prototype = new Human('Tom');
  19. Girl.prototype = new Human('Stacy');