-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path080_Build JavaScript Objects.js
More file actions
47 lines (38 loc) · 1.3 KB
/
080_Build JavaScript Objects.js
File metadata and controls
47 lines (38 loc) · 1.3 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
//[COMMENTS]
/*
You may have heard the term object before.
Objects are similar to arrays, except that instead of using indexes to access and modify their data, you access
the data in objects through what are called properties.
Here's a sample object:
var cat = {
"name": "Whiskers",
"legs": 4,
"tails": 1,
"enemies": ["Water", "Dogs"]
};
Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.
Instructions
Make an object that represents a dog called myDog which contains the properties "name" (a string), "legs", "tails" and "friends".
You can set these object properties to whatever values you want, as long "name" is a string, "legs" and "tails" are numbers,
and "friends" is an array.
myDog should contain the property name and it should be a string.
myDog should contain the property legs and it should be a number.
myDog should contain the property tails and it should be a number.
myDog should contain the property friends and it should be an array.
myDog should only contain all the given properties.
*/
//[COMMENTS]
// Example
var ourDog = {
"name": "Camper",
"legs": 4,
"tails": 1,
"friends": ["everything!"]
};
// Only change code below this line.
var myDog = {
"name":"Butch",
"legs":4,
"tails":1,
"friends":["Aritra","Mary"]
};