1
1
// Declare and assign the variables below
2
-
2
+ let nameOfSpaceShuttle = "Determination" ;
3
+ let shuttleSpeedMph = 17500 ;
4
+ let distanceToMarsKm = 225000000 ;
5
+ let distanceToMoonKm = 384400 ;
6
+ const milesPerKilometer = .621 ;
3
7
// Use console.log to print the 'typeof' each variable. Print one item per line.
4
-
8
+ console . log ( typeof ( nameOfSpaceShuttle ) ) ;
9
+ console . log ( typeof ( shuttleSpeedMph ) ) ;
10
+ console . log ( typeof ( distanceToMarsKm ) ) ;
11
+ console . log ( typeof ( distanceToMoonKm ) ) ;
12
+ console . log ( typeof ( milesPerKilometer ) ) ;
5
13
// Calculate a space mission below
6
-
14
+ let milesToMars = distanceToMarsKm * milesPerKilometer ;
15
+ let hoursToMars = milesToMars / shuttleSpeedMph ;
16
+ let daysToMars = hoursToMars / 24 ;
7
17
// Print the results of the space mission calculations below
8
-
18
+ console . log ( nameOfSpaceShuttle + " will take " + daysToMars + " days to reach Mars." ) ;
9
19
// Calculate a trip to the moon below
10
-
11
- // Print the results of the trip to the moon below
20
+ let milesToMoon = distanceToMoonKm * milesPerKilometer ;
21
+ let hoursToMoon = milesToMoon / shuttleSpeedMph ;
22
+ let daysToMoon = hoursToMoon / 24 ;
23
+ // Print the results of the trip to the moon below
24
+ console . log ( nameOfSpaceShuttle + " will take " + daysToMoon + " days to reach the Moon." ) ;
0 commit comments