1
1
// 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 ;
2
7
3
8
// Use console.log to print the 'typeof' each variable. Print one item per line.
4
-
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' ) ;
5
14
// Calculate a space mission below
6
-
15
+ let milesToMars = distanceToMarsKm * milesPerKm ;
16
+ let hoursToMars = milesToMars / shuttleSpeedMph ;
17
+ let daysToMars = hoursToMars / 24 ;
7
18
// Print the results of the space mission calculations below
8
-
19
+ console . log ( shuttleName + " will take " + daysToMars + " days to reach Mars." ) ;
9
20
// Calculate a trip to the moon below
10
-
11
- // Print the results of the trip to the moon below
21
+ let milesToMoon = distanceToMoonKm * milesPerKm ;
22
+ let hoursToMoon = milesToMoon / shuttleSpeedMph ;
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