function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype.getDetails = function() {
return this.name + ' is ' + this.age + ' years old.';
};
const john = new Person('John', 25);
console.log(john.getDetails()); Post #2068
5.89K
CHALLENGE
- 👍 11
- ❤ 1