You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

variables.js 870B

123456789101112131415161718192021222324
  1. let shuttleName = "Determination";
  2. let shuttleSpeedMph = 17_500;
  3. const DISTANCE_TO_MARS_KM = 225_000_000;
  4. const DISTANCE_TO_MOON_KM = 384_400;
  5. const MILES_PER_KM = 0.621;
  6. const HOURS_PER_DAY = 24;
  7. console.log(typeof shuttleName);
  8. console.log(typeof shuttleSpeedMph);
  9. console.log(typeof DISTANCE_TO_MARS_KM);
  10. console.log(typeof DISTANCE_TO_MOON_KM);
  11. console.log(typeof MILES_PER_KM);
  12. let milesToMars = (DISTANCE_TO_MARS_KM * MILES_PER_KM);
  13. let hoursToMars = (milesToMars / shuttleSpeedMph);
  14. let daysToMars = (hoursToMars / HOURS_PER_DAY);
  15. console.log(`${shuttleName} will take ${daysToMars.toFixed(2)} days to reach Mars.`);
  16. let milesToMoon = (DISTANCE_TO_MOON_KM * MILES_PER_KM);
  17. let hoursToMoon = (milesToMoon / shuttleSpeedMph);
  18. let daysToMoon = (hoursToMoon / HOURS_PER_DAY);
  19. console.log(`${shuttleName} will take ${daysToMoon.toFixed(2)} days to reach Moon.`);