-
Notifications
You must be signed in to change notification settings - Fork 4k
Expand file tree
/
Copy pathscript.js
More file actions
executable file
·42 lines (39 loc) · 1.38 KB
/
script.js
File metadata and controls
executable file
·42 lines (39 loc) · 1.38 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
/**
* Practice: Building objects
*
* - Create JavaScript objects based on objects in your current environment.
* - Give each object an identifiable name.
* - Create properties to describe the objects and set their values.
* - Find an object that has another object inside of it to create a nested object.
* - Test your objects in the browser console by accessing the entire object and its specific properties.
*/
// eslint-disable-next-line no-unused-vars
const boxCigarettes = {
name: "L.A ICE",
volume: 16,
size: {
width: 5,
length: 15,
},
material: "Stainles",
boxOpen: false,
methodOpen: "Button",
toggleLid: function (boxStatus) {
this.boxOpen = boxStatus;
},
pressButton: {
inPress: "Open Box",
outPress: "Close Box",
},
onPressButton: function (xInPress, xOutPress) {
(this.pressButton.inPress = xInPress),
(this.pressButton.outPress = xOutPress);
},
};
// console.log("This object box cigarettes", boxCigarettes);
// console.log("This properties volume: ", boxCigarettes.volume);
// console.log("This properties size width: ", boxCigarettes.size.width);
// console.log("This properties value size: ", boxCigarettes.size);
// console.log("value before press button: ", boxCigarettes.pressButton.inPress);
// boxCigarettes.onPressButton("Openn", "Closee");
// console.log("value after press button: ", boxCigarettes.pressButton.inPress);