Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Personn {
- constructor(name,age){
- this.name = name ;
- this.age = age ;
- }
- tellMyName() {
- console.log(`I am ${this.name}`);
- }
- tellMyAge() {
- console.log(`I am ${this.age} years old`);
- }
- }
- let firstPersonn = new Personn ("John", 40);
- firstPersonn.tellMyName();
- firstPersonn.tellMyAge();
- let secondPersonn = new Personn ("Mary", 35);
- secondPersonn.tellMyName();
- secondPersonn.tellMyAge();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement