File tree 3 files changed +70
-10
lines changed
3 files changed +70
-10
lines changed Original file line number Diff line number Diff line change 1
- let tortoiseOne = {
2
- species : "Galapagos Tortoise" ,
3
- name : "Pete" ,
4
- weight : 919 ,
5
- age : 85 ,
6
- diet : [ "pumpkins" , "lettuce" , "cabbage" ]
7
- } ;
8
-
9
- // Using a for..in loop, iterate through each property in the tortoiseOne object and print the value to the console.
1
+ // let tortoiseOne = {
2
+ // species: "Galapagos Tortoise",
3
+ // name: "Pete",
4
+ // weight: 919,
5
+ // age: 85,
6
+ // diet: ["pumpkins", "lettuce", "cabbage"]
7
+ // };
8
+
9
+ // // Using a for..in loop, iterate through each property in the tortoiseOne object and print the value to the console.
10
+
11
+ // // let giraffe = {
12
+ // // species: "Reticulated Giraffe",
13
+ // // name: "Cynthia",
14
+ // // weight: 1500,
15
+ // // age: 15,
16
+ // // diet: "leaves"
17
+ // // };
18
+
19
+ // for (item in tortoiseOne) {
20
+ // console.log(item + ',' + tortoiseOne[item]);
21
+ // }
22
+ // let tortoiseOne = {
23
+ // age: 150,
24
+ // species: "Galapagos Tortoise",
25
+ // diet: ["pumpkins", "lettuce", "cabbage"]
26
+ // };
27
+
28
+ // let tortoiseTwo = {
29
+ // age: 150,
30
+ // species: "Galapagos Tortoise",
31
+ // diet: ["pumpkins", "lettuce", "cabbage"]
32
+ // };
33
+
34
+ // console.log(tortoiseOne == tortoiseTwo);
35
+ // console.log(tortoiseOne === tortoiseTwo);
36
+ // console.log(tortoiseOne.age === tortoiseTwo.age);
37
+ let num = Math . floor ( Math . random ( ) * 10 ) ;
38
+
39
+ console . log ( num ) ;
Original file line number Diff line number Diff line change @@ -14,4 +14,10 @@ function randomSelection(arr){
14
14
//Experiment with the code above. Try to:
15
15
//a) Print 3 random selections from each array.
16
16
//b) Have the code randomly pick one array, and then print 2 random items from it.
17
- //c) Create a new array, then fill it with one random item from words and happiness. Print the new array.
17
+ //c) Create a new array, then fill it with one random item from words and happiness. Print the new array.
18
+
19
+
20
+ console . log ( randomSelection ( happiness ) ) ;
21
+ console . log ( randomSelection ( words ) ) ;
22
+
23
+
Original file line number Diff line number Diff line change @@ -14,6 +14,30 @@ let salamander = {
14
14
15
15
16
16
// After you have created the other object literals, add the astronautID property to each one.
17
+ let monkeyTwo = {
18
+ name : "Brad" ,
19
+ species : "Chimpanzee" ,
20
+ mass : 11 ,
21
+ age : 6
22
+ } ;
23
+
24
+ let doggyOne = {
25
+ name : "Leroy" ,
26
+ species : "Beagle" ,
27
+ mass : 14 ,
28
+ age : 5.
29
+ } ;
30
+
31
+ let specimenOne = {
32
+ name : "Almina" ,
33
+ species : "Tardigrade" ,
34
+ mass : .0000000001 ,
35
+ age : 1
36
+ } ;
37
+
38
+ superChimpOne . astronautID = Math . round ( ) * 10
39
+
40
+
17
41
18
42
// Create an array to hold the animal objects.
19
43
You can’t perform that action at this time.
0 commit comments