16. function Human(name) { if (name === undefined) { name = 'Taro'; } this.name = name; } Human.prototype.hello = function() { console.log('My name is ' + this.name); }; class Human { constructor(name = 'Taro') { this.name = name; } hello() { console.log(`My name is ${this.name}`); } } ES5 ES6
{{#tags}}- {{label}}
{{/tags}}