GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaScript-Lessons/ES6/Inheritance/main.js at master · ankitpandey84/JavaScript-Lessons Expand file tree/ Copy pathmain.jsMore file actions 47 lines (34 loc) · 809 Bytes / Copy pathmain.jsFile metadata and controls47 lines (34 loc) · 809 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 "use strict"; class Person{ constructor(name, age, weight){ this.name = name; this.age = age; this.weight = weight; } displayName(){ console.log(this.name); } displayAge(){ console.log(this.age); } displayWeight(){ console.log(this.weight) } } class Programmer extends Person{ constructor(name, age, weight, language){ super(name, age, weight); this.language = language; } displayLanguage(){ console.log(this.language); } } let sally = new Person('Sally Jones', 21, 89); sally.displayName(); sally.displayAge(); sally.displayWeight(); console.log('----------'); let bucky = new Programmer('Bucky Roberts', 87, 250, 'JavaScript'); bucky.displayName(); bucky.displayLanguage(); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |