You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
501 B
21 lines
501 B
class Person {
|
|
constructor (name, age, eyes) {
|
|
this.name = name;
|
|
this.age = age;
|
|
this.eyes = eyes;
|
|
}
|
|
|
|
talk(words) {
|
|
console.log(`I am ${this.name} and ${words}.`);
|
|
}
|
|
}
|
|
|
|
let alex = new Person("Alex", 16, "green");
|
|
let mary = new Person("Mary", 44, "brown");
|
|
let frank = new Person("Frank", 34, "blue");
|
|
|
|
frank.talk("I am talking here!");
|
|
mary.talk("these are some words");
|
|
alex.talk("Hi there!");
|
|
|
|
console.log(`Frank is ${frank.age}, Mary is ${mary.age}, Alex is ${alex.age}`);
|
|
|