-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathscript.js
More file actions
executable file
·30 lines (28 loc) · 807 Bytes
/
script.js
File metadata and controls
executable file
·30 lines (28 loc) · 807 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
/**
* 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.
*/
// eslint-disable-next-line no-unused-vars
const backpack = {
name: "Everyday Backpack",
volume: 30,
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;
},
// method object property name
methodName: function () {},
};