Skip to content

Commit b81b502

Browse files
committed
almost done, finishing up and working out bugs
1 parent 7ea2013 commit b81b502

File tree

1 file changed

+52
-3
lines changed

1 file changed

+52
-3
lines changed

objects-and-math/exercises/ObjectExercises.js

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
let steps = 0
2+
13
let superChimpOne = {
24
name: "Chad",
35
species: "Chimpanzee",
@@ -9,14 +11,61 @@ let salamander = {
911
name: "Lacey",
1012
species: "Axolotl Salamander",
1113
mass: 0.1,
12-
age: 5
14+
age: 5,
15+
move: function(steps) {
16+
return Math.floor(Math.random(steps)*11)
17+
}
18+
};
19+
20+
let superChimpTwo = {
21+
name: "Brad",
22+
species: "Chipanzee",
23+
mass: 11,
24+
age: 6,
25+
move: function() {
26+
return Math.floor(Math.random()*11)
27+
}
28+
};
29+
30+
let beagleBoy = {
31+
name: "Leroy",
32+
species: "Beagle",
33+
mass: 14,
34+
age: 5,
35+
move: function() {
36+
return Math.floor(Math.random()*11)
37+
}
1338
};
1439

40+
let tardy = {
41+
name: "Almina",
42+
species: "Tardigrade",
43+
mass: 0.0000000001,
44+
age: 1,
45+
move: function() {
46+
return Math.floor(Math.random()*11)
47+
}
48+
};
49+
console.log(superChimpOne);
1550

1651
// After you have created the other object literals, add the astronautID property to each one.
52+
superChimpOne['astronautID'] = 3;
53+
superChimpTwo['astronautID'] = 4;
54+
salamander['astronautID'] = 6;
55+
beagleBoy['astronautID'] = 7;
56+
tardy['astronautID'] = 9;
1757

18-
// Create an array to hold the animal objects.
58+
superChimpOne['move'] = function(steps) {return (Math.floor(Math.random(steps)*11))};
1959

60+
// Create an array to hold the animal objects.
61+
crew = [superChimpOne, superChimpTwo, salamander, beagleBoy, tardy]
2062
// Print out the relevant information about each animal.
2163

22-
// Start an animal race!
64+
// Start an animal race!
65+
66+
function crewReports(crew) {
67+
return (`${crew.name} is a ${crew.species}. They are ${crew.age} years old and ${crew.mass} kilograms. Their ID is ${crew.astronautID}.`)
68+
}
69+
console.log(crewReports(crew[2]))
70+
71+
function fitnessTest (candidates) {}

0 commit comments

Comments
 (0)