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 995B

123456789101112131415161718192021222324252627282930
  1. 'use strict'
  2. let nameSS = "Determination";
  3. let shuttleSpeedMph = 17_500;
  4. const DISTANCE_TO_MARS_KM = 225_000_000;
  5. const DISTANCE_TO_MOON_KM = 384_400;
  6. const MILES_PER_KM = 0.621;
  7. const HOURS_PER_DAY = 24;
  8. console.log(typeof (nameSS));
  9. console.log(typeof (shuttleSpeedMph));
  10. console.log(typeof (DISTANCE_TO_MARS_KM));
  11. console.log(typeof (DISTANCE_TO_MOON_KM));
  12. console.log(typeof (MILES_PER_KM));
  13. let milesMars = (DISTANCE_TO_MARS_KM * MILES_PER_KM);
  14. let hoursMars = (milesMars / shuttleSpeedMph);
  15. let daysMars = (hoursMars / HOURS_PER_DAY);
  16. console.log(milesMars, 'miles to Mars');
  17. console.log(hoursMars, 'hours to Mars');
  18. console.log(nameSS, 'will take', daysMars, 'days to reach Mars');
  19. let milesMoon = (DISTANCE_TO_MOON_KM * MILES_PER_KM);
  20. let hoursMoon = (milesMoon / shuttleSpeedMph);
  21. let daysMoon = (hoursMoon / HOURS_PER_DAY);
  22. console.log(milesMoon, 'Miles to the Moon');
  23. console.log(hoursMoon, 'hours to Mars');
  24. console.log(nameSS, 'will take', daysMoon, 'days to reach the Moon');