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.

exercise_1.js 807B

123456789101112131415161718192021222324
  1. 'use strict'
  2. let ShuttleName = "Determination";
  3. let ShuttleSpeed = 17500;
  4. const DISTANCE_MARS = 225000000;
  5. const DISTANCE_MOON = 384400;
  6. const MILES_PER_KM = 0.621;
  7. const HOURS_PER_DAY = 24;
  8. console.log(typeof ShuttleName);
  9. console.log(typeof ShuttleSpeed);
  10. console.log(typeof DISTANCE_MARS);
  11. console.log(typeof DISTANCE_MOON);
  12. console.log(typeof MILES_PER_KM);
  13. let MilesToMars = DISTANCE_MARS * MILES_PER_KM;
  14. let HoursToMars = MilesToMars / ShuttleSpeed;
  15. let DaysToMars = HoursToMars / HOURS_PER_DAY;
  16. let MilesToMoon = DISTANCE_MOON * MILES_PER_KM;
  17. let HoursToMoon = MilesToMoon / ShuttleSpeed;
  18. let DaysToMoon = HoursToMoon / HOURS_PER_DAY;
  19. console.log(ShuttleName + " will take " + DaysToMars + "days to reach Mars.");
  20. console.log(ShuttleName + " will take " + DaysToMoon + "days to reach the Moon.");