At our space base, it is a historic day! Five non-human animals are ready to run a space mission without our assistance! For the exercises, you will use the same five animal objects throughout.
Based on the two object literals provided in the starter code, create new object literals for three more animals:
|Name||Species||Mass (kg)||Age (years)|
For each animal, add a property called
should be assigned a number between 1 and 10 (including 10). However, no
crew members should have the same ID.
move method to each animal object. The
move method will select a
random number of steps from 0 to 10 for the animal to take. The number can
be 0 as well as 10.
Upper management at the space base wants us to report all of the relevant information about the animal astronauts.
crewReports function to accomplish this. When passed one of the
animal objects, the function returns a template literal with the following
'____ is a ____. They are ____ years old and ____ kilograms. Their ID is
Fill in the blanks with the name, species, age, mass, and ID for the selected animal.
Before these animal astronauts can get ready for launch, they need to take a
physical fitness test. Define a
fitnessTest function that takes an array as
Within the function, race the five animals together by using the
method. An animal is done with the race when they reach 20 steps or greater.
Store the result as a string:
'____ took ____ turns to take 20 steps.'
Fill in the blanks with the animal’s name and race result. Create a new array
to store how many turns it takes each animal to complete the race.
Return the array from the function, then print the results to the console (one animal per line).
HINT: There are a lot of different ways to approach this problem. One way
that works well is to see how many iterations of the
move method it will
take for each animal to reach 20 steps.