Created
March 18, 2019 11:27
-
-
Save mehdihettak/929d956c3140b28d5ba4dcd8bb4ea643 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
| class person { | |
| constructor(name, age) { | |
| this.age = age; | |
| this.name = name | |
| } | |
| tellMyAge() { | |
| console.log(`I am ${this.age} years old`) | |
| } | |
| tellMyName() { | |
| console.log(`I am ${this.name}`); | |
| } | |
| } | |
| const john = new person("John", 40) | |
| const mary= new person("Mary", 35) | |
| john.tellMyName() | |
| john.tellMyAge() | |
| mary.tellMyName() | |
| mary.tellMyAge() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment