props.age; } introduce() { console.log(`Hi. My name is ${this.name}. I am ${this.age} years old.`); } getOlder() { this.age += 1; } } const p1 = new Person({ name: 'John', age: 20 }); p1.getOlder(); p1.introduce(); // My name is John. I am 21 years old.
is ${state.name}. I am ${state.age} years old.`); }, getOlder() { state.age += 1; } } } const p1 = person({ name: 'John', age: 20 }); p1.getOlder(); p1.introduce(); // Hi. My name is John. I am 21 years old. p1.name; // undefined p1.age; // undefined
position: 0 }; return Object.assign({}, barker(state), driver(state), killer(state)); } const rex = murderRobotDog('Rex'); rex.bark(); // Woof, I am Rex rex.kill(); // Just killed something rex.drive();