Skip to content

Commit a62b9cb

Browse files
committed
days to the Moon and Mars
1 parent abe8c86 commit a62b9cb

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
// Declare and assign the variables below
2-
2+
let shuttleName = "Determination";
3+
let shuttleSpeed = 17500;
4+
let distanceMars = 225000000;
5+
let distanceMoon = 384400;
6+
let mpk = 0.621;
37
// Use console.log to print the 'typeof' each variable. Print one item per line.
4-
8+
console.log(typeof shuttleName);
9+
console.log(typeof shuttleSpeed);
10+
console.log(typeof distanceMars);
11+
console.log(typeof distanceMoon);
12+
console.log(typeof mpk);
513
// Calculate a space mission below
6-
14+
let milesToMars = distanceMars * mpk;
15+
let hoursToMars = milesToMars / shuttleSpeed;
16+
let daysToMars = hoursToMars / 24;
717
// Print the results of the space mission calculations below
8-
18+
console.log(shuttleName + 'will take' + daysToMars + 'days to reach Mars.')
919
// Calculate a trip to the moon below
10-
11-
// Print the results of the trip to the moon below
20+
let milesToMoon = distanceMoon * mpk;
21+
let hoursToMoon = milesToMoon / shuttleSpeed;
22+
let daysToMoon = hoursToMoon / 24;
23+
// Print the results of the trip to the moon below
24+
console.log(shuttleName + 'will take' + daysToMoon + 'days to reach the Moon')

data-and-variables/exercises/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)