-
Notifications
You must be signed in to change notification settings - Fork 4k
Expand file tree
/
Copy pathscript.js
More file actions
executable file
·47 lines (44 loc) · 1.2 KB
/
script.js
File metadata and controls
executable file
·47 lines (44 loc) · 1.2 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
/**
* 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.
*/
const cricketBat = {
name: "SG BAT",
Timber: "English Willow",
palyersThatuse: {
india:{
player1: "Virat Kohli",
player2: "Rohit Sharma",
},
australia:{
player1: "Steve Smith",
player2: "David Warner",
},
newzealand:{
player1: "Kane Williamson",
player2: "Ross Taylor",
}
},
weight: 1.2,
size: {
length: 85,
width: 10,
},
warranty: true,
price: 10000,
used: false,
thebatisused: function (used) {
this.used = used;
if (this.used === true) {
console.log(`The bat is used.`);
}else{
console.log(`The bat is not used.`);
}
}
}
console.log(cricketBat);