Repository navigation
Expand file tree
/
Copy pathBackpack.js
More file actions
105 lines (85 loc) · 1.81 KB
/
Copy pathBackpack.js
File metadata and controls
105 lines (85 loc) · 1.81 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
* Creating classes:
*
* Class declaration: class Name {}
* Class expression: const Name = class {}
*/
/*class Backpack {
constructor(
// Defines parameters:
name,
volume,
color,
pocketNum,
strapLengthL,
strapLengthR,
lidOpen
) {
// Define properties:
this.name = name;
this.volume = volume;
this.color = color;
this.pocketNum = pocketNum;
this.strapLength = {
left: strapLengthL,
right: strapLengthR,
};
this.lidOpen = lidOpen;
}
// Add methods like normal functions:
toggleLid(lidStatus) {
this.lidOpen = lidStatus;
}
newStrapLength(lengthLeft, lengthRight) {
this.strapLength.left = lengthLeft;
this.strapLength.right = lengthRight;
}
}
export default Backpack; */
/* class purse {
constructor(
// Defines Paramenters:
designer,
color,
type,
size,
model,
) {
//Defines Properties:
this.designer = designer;
this.color = color;
this.type = type;
this.size = size;
this.model = model;
//Add methods like normal functions:
function() {
return this.size + " " + this.color + " " + this.designer +" " + this.type +" " + "bag."
}
}; */
import purse from "./file.js";
const everydayPurse = new purse (
"Chanel",
"Black",
"Crossbody",
"small",
4,
"Everyday Purse",
);
console.log("The object Everyday Purse: ", everydayPurse);
const eveningPurse = new purse (
"Fendi",
"Gold",
"Clutch",
"medium",
1,
"Evening Purse",
);
console.log("The object Evening Purse: ", eveningPurse);
const workPurse = new purse (
"Coach",
"Beige",
"Satchel",
"Medium",
12,
);
console.log("The object work purse: ", workPurse);