Skip to content

Instantly share code, notes, and snippets.

@obetame
Last active September 12, 2020 09:36
Show Gist options
  • Save obetame/66dff06e3d5df71ad82265184336b25c to your computer and use it in GitHub Desktop.
Save obetame/66dff06e3d5df71ad82265184336b25c to your computer and use it in GitHub Desktop.
function Person(name, age) {
this.name = name;
this.age = age;
this.getName = function() {
return this.name;
}
}
Person.prototype.getAge = function() {
return this.age;
}
const person1 = new Person('rick', 14);
const person2 = new Person('morty', 60);
console.log(person1.getName()); // output: rick
console.log(person1.getAge()); // output: 14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment