Last active
September 12, 2020 09:36
-
-
Save obetame/66dff06e3d5df71ad82265184336b25c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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