Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person{
- constructor(name, age){
- this.name = name;
- this.age = age;
- }
- getName(){
- console.log("i am "+ this.name);
- }
- getAge(){
- console.log("I am "+ this.age+" years old.");
- }
- }
- const person1 = new Person("Jhon", 25);
- const person2 = new Person( "Mary", 45);
- person1.getName() + person1.getAge()
- person2.getName() + person2.getAge()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement