We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b019c5 commit 6744381Copy full SHA for 6744381
04_objects.js
@@ -0,0 +1,36 @@
1
+// Some objects
2
+// The 'key' can either be with quotes or not if its a single word
3
+var myDog = {
4
+ name: 'flanagan',
5
+ 'the legs': 5,
6
+ tails: 0,
7
+ friends: ['j', 2]
8
+};
9
+
10
+// Object access to properties
11
+var name = myDog.name;
12
+var legs = myDog['the legs'];
13
14
+var property = 'friends';
15
+var friends = myDog[property];
16
17
+// Modify properties
18
+myDog.name = 'Antonio'
19
+myDog.bark = 'woof'
20
+delete myDog.tails
21
22
+// Check if property exists
23
+console.log(myDog.hasOwnProperty('tails'))
24
25
+// Access complex objects
26
+var myPlants = [
27
+ {
28
+ type: "flowers",
29
+ list: ["rose", "tulip", "dandelion"]
30
+ },
31
32
+ type: "trees",
33
+ list: ["fir", "pine", "birch"]
34
+ }
35
+];
36
+var secondTree = myPlants[1].list[1];
05_loops.js
0 commit comments