Skip to content

Commit 7bdccb8

Browse files
committed
Exercise 4 commit
1 parent 9803b43 commit 7bdccb8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
// Declare and assign the variables below
2+
let shuttleName = 'Determination';
3+
let shuttleSpeedMph = 17500;
4+
let distanceToMarsKm = 225000000;
5+
let distanceToMoonKm = 38400;
6+
const milesPerKm = 0.621;
27

38
// Use console.log to print the 'typeof' each variable. Print one item per line.
9+
console.log(typeof shuttleName);
10+
console.log(typeof shuttleSpeedMph);
11+
console.log(typeof distanceToMarsKm);
12+
console.log(typeof distanceToMoonKm);
13+
console.log(typeof milesPerKm);
414

515
// Calculate a space mission below
16+
let milesToMars = distanceToMarsKm * milesPerKm;
17+
let hoursToMars = milesToMars / shuttleSpeedMph;
18+
let daysToMars = hoursToMars / 24;
619

720
// Print the results of the space mission calculations below
21+
console.log(shuttleName + " will take " + daysToMars + " days to reach Mars.");
822

923
// Calculate a trip to the moon below
24+
let milesToMoon = distanceToMoonKm * milesPerKm;
25+
let hoursToMoon = milesToMoon / shuttleSpeedMph;
26+
let daysToMoon = hoursToMoon / 24;
1027

11-
// Print the results of the trip to the moon below
28+
// Print the results of the trip to the moon below
29+
console.log(shuttleName + " will take " + daysToMoon + " days to reach the Moon.");

0 commit comments

Comments
 (0)