Skip to content

Commit 18f96f7

Browse files
committed
Data and Variables Exercise Completed
1 parent 9e88293 commit 18f96f7

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed
Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
// Declare and assign the variables below
2+
let shuttleName = "Determination";
3+
let shuttleSpeed = 17500;
4+
let distanceToMars = 225000000;
5+
let distanceToTheMoon = 384400;
6+
let milesPerKm = 0.621;
27

38
// Use console.log to print the 'typeof' each variable. Print one item per line.
4-
9+
console.log(typeof shuttleName);
10+
console.log(typeof shuttleSpeed);
11+
console.log(typeof distanceToMars);
12+
console.log(typeof distanceToTheMoon);
13+
console.log(typeof milesPerKm);
514
// Calculate a space mission below
6-
15+
let milesToMars = (distanceToMars * milesPerKm);
16+
let hoursToMars = (milesToMars / shuttleSpeed);
17+
let daysToMars = (hoursToMars / 24);
718
// Print the results of the space mission calculations below
8-
19+
console.log(shuttleName +" will take " + daysToMars + " days to reach Mars.");
920
// Calculate a trip to the moon below
10-
11-
// Print the results of the trip to the moon below
21+
let milesToMoon = (distanceToTheMoon * milesPerKm);
22+
let hoursToMoon = (milesToMoon / shuttleSpeed);
23+
let daysToMoon = (hoursToMoon / 24);
24+
// Print the results of the trip to the moon below
25+
console.log(shuttleName +" will take " + daysToMoon + " days to reach the Moon.");

0 commit comments

Comments
 (0)