-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.js
More file actions
33 lines (29 loc) · 785 Bytes
/
class.js
File metadata and controls
33 lines (29 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// class
class Car {
constructor(brand, model, year, color, movie) {
this.brandCar = brand;
this.modelCar = model;
this.yearCar = year;
this.colorCar = color;
this.movie = movie;
}
sayHello() {
console.log(
`I am a car ${this.brandCar} model: ${this.modelCar}. I was made in: ${this.yearCar} and I am in color: ${this.colorCar}`
);
}
showYear() {
console.log(`I was made in: ${this.yearCar}`);
}
showMovie() {
console.log(`I played the movie: ${this.movie}`);
}
}
const toyota = new Car("Toyota", "Camry", 2024, "Yellow", "The Fast and the Furious");
const ford = new Car("Ford", "Mustang GT Fastback 390", 1968, "dark green", "Bullitt");
ford.sayHello();
//ford.showYear();
ford.showMovie();
toyota.sayHello();
//toyota.showYear();
toyota.showMovie();