Browse Source

Data and variables: Now calculate a trip to the Moon.

master
AzureAD\SigridLievens 2 years ago
parent
commit
e7934c12e3
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      variables.js

+ 6
- 1
variables.js View File

@@ -15,5 +15,10 @@ let milesToMars = (DISTANCE_TO_MARS_KM * MILES_PER_KM);
let hoursToMars = (milesToMars / shuttleSpeedMph);
let daysToMars = (hoursToMars / HOURS_PER_DAY);

console.log(shuttleName + ' will take ' + daysToMars + ' days to reach Mars.');
console.log(`${shuttleName} will take ${daysToMars.toFixed(2)} days to reach Mars.`);

let milesToMoon = (DISTANCE_TO_MOON_KM * MILES_PER_KM);
let hoursToMoon = (milesToMoon / shuttleSpeedMph);
let daysToMoon = (hoursToMoon / HOURS_PER_DAY);

console.log(`${shuttleName} will take ${daysToMoon.toFixed(2)} days to reach Moon.`);

Loading…
Cancel
Save