Skip to content

Commit 8817a6c

Browse files
author
Edward King
committed
Data and variable exercise complete
1 parent 042e981 commit 8817a6c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

data-and-variables/exercises/data-and-variables-exercises.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,26 @@
88

99
// Calculate a trip to the moon below
1010

11-
// Print the results of the trip to the moon below
11+
// Print the results of the trip to the moon below
12+
13+
let shuttleName = 'Determination';
14+
let shuttleSpeedMph = 17500;
15+
let distanceToMarsKm = 225000000;
16+
let distanceToMoonKm = 38400;
17+
const milesPerKm = 0.621;
18+
19+
/*console.log(typeof(shuttleName));
20+
console.log(typeof(shuttleSpeedMph));
21+
console.log(typeof(distanceToMarsKm));
22+
console.log(typeof(distanceToMoonKm));
23+
console.log(typeof(milesPerKm));*/
24+
25+
/*let milesToMars = distanceToMarsKm * milesPerKm;
26+
let hoursToMars = milesToMars / shuttleSpeedMph;
27+
let daysToMars = hoursToMars / 24;*/
28+
29+
let milesToMoon = distanceToMoonKm * milesPerKm;
30+
let hoursToMoon = milesToMoon / shuttleSpeedMph;
31+
let daysToMoon = hoursToMoon / 24;
32+
33+
console.log(shuttleName+" will take "+daysToMoon+" days to reach the Moon.");

0 commit comments

Comments
 (0)