-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstructor.js
More file actions
58 lines (46 loc) · 1.52 KB
/
constructor.js
File metadata and controls
58 lines (46 loc) · 1.52 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// constructor
// call - flight ( ) 4 or a 5
// call back and set time out
// class car ...
//
class Car {
constructor(brand, color, price, capacity) {
this.brand = brand;
this.color = color;
this.price = price;
this.capacity = capacity;
}
output() {
console.log(`I want a car ${this.brand} \nI want any dark color ${this.color}
\nMy price range is upto ${this.price} \nI want a max boot space of ${this.capacity}`);
}
}
const finaloutput = new Car("BMW","Black","50 Lakhs","7 seater");
finaloutput.output();
// flight Task
class flight {
constructor (airlines, variant, price, route){
this.airlines=airlines;
this.variant=variant;
this.price=price;
this.route=route;
}
message (){
console.log(` I want an decent Flight ${this.airlines} \n I wnat an good ticket ${this.variant} \n I want a discount price ${this.price} \n I want to fly route above ${this.route}`)
}
}
const finalMessage = new flight("Emarites", "Business Class", "1 lakh", "via India");
finalMessage.message();
// constructor pratice
class House {
constructor (Place, date, bhk){
this.Place=Place;
this.date=date;
this.bhk=bhk;
}
plan(){
console.log(`We are inviting to our new House at ${this.Place}\nthe function will he held on ${this.date}\nour home has bedroom${this.bhk}`);
}
}
const housewarming = new House ("Anna Nagar", "Aug month", "4 BHK House");
housewarming.plan();