forked from Davincii254/Space-Program-using-Obj
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjects.js
More file actions
35 lines (27 loc) · 1.01 KB
/
Copy pathobjects.js
File metadata and controls
35 lines (27 loc) · 1.01 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
const nairobi_bars_association = {
// Propeties (data)
name: "Zabe",
location: "Nairobi CBD",
isOpen: false,
capacity: 20,
// Methods (functionlity)
toggleOpenStatus: function () {
if (this.isOpen) {
console.log(this.name + " is now open");
this.isOpen = false;
} else {
console.log(this.name + " is now closed!");
this.isOpen = true;
}
}
}
console.log(nairobi_bars_association)
// accessing properties
console.log("Shop Name" + nairobi_bars_association.name);
console.log("LOcation " + nairobi_bars_association.location);
console.log("capicity before renovation was", + nairobi_bars_association.capacity);
nairobi_bars_association.capacity = 30;
console.log("capicity after renovation is", + nairobi_bars_association.capacity);
console.log("current status of the bar is", nairobi_bars_association.isOpen);
nairobi_bars_association.toggleOpenStatus();
console.log("Status after toggle:" + nairobi_bars_association.isOpen)