File tree 1 file changed +19
-5
lines changed
data-and-variables/exercises 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change 1
1
// Declare and assign the variables below
2
+ let shuttleName = "Determination" ;
3
+ let shuttleSpeed = 17500 ;
4
+ let distanceToMars = 225000000 ;
5
+ let distanceToTheMoon = 384400 ;
6
+ let 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 shuttleSpeed ) ;
11
+ console . log ( typeof distanceToMars ) ;
12
+ console . log ( typeof distanceToTheMoon ) ;
13
+ console . log ( typeof milesPerKm ) ;
5
14
// Calculate a space mission below
6
-
15
+ let milesToMars = ( distanceToMars * milesPerKm ) ;
16
+ let hoursToMars = ( milesToMars / shuttleSpeed ) ;
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 = ( distanceToTheMoon * milesPerKm ) ;
22
+ let hoursToMoon = ( milesToMoon / shuttleSpeed ) ;
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." ) ;
You can’t perform that action at this time.
0 commit comments