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