-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathscript.js
More file actions
executable file
·37 lines (33 loc) · 896 Bytes
/
script.js
File metadata and controls
executable file
·37 lines (33 loc) · 896 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
34
35
36
37
/**
* Practice: Making methods
*
* - Create a method for each object property.
* - The method receives a value to match the property to be changed.
* - Create a simple function to replace the current property value with the received value.
* - Test the method by sending new values and checking the properties in the console.
*/
const backpack = {
name: "Everyday Backpack",
volume: high,
color: "grey",
pocketNum: 15,
strapLength: {
left: 26,
right: 26,
},
toggleLid: function (lidStatus) {
this.lidOpen = lidStatus;
},
newStrapLength: function (lengthLeft, lengthRight) {
this.strapLength.left = lengthLeft;
this.strapLength.right = lengthRight;
},
newVolume: function( kyte) {
this.volume.high = kyte;
},
newPocketNum: function (pocket) {
this.pocketNum = pocket;
},
};
backpack.newVolume(40)
console.log( backpack.newVolume);