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

123456789101112131415161718192021222324
  1. let shuttleName ='Determination';
  2. let shuttleSpeed = 17500;
  3. const DISTANCE_TO_MARS_KM = 225000000;
  4. const DISTANCE_TO_THE_MOON_KM = 384400;
  5. const MILES_PER_KM = 0.621;
  6. const HOURS_PER_DAY = 24;
  7. console.log(typeof shuttleName);
  8. console.log(typeof shuttleSpeed);
  9. console.log(typeof DISTANCE_TO_MARS_KM);
  10. console.log(typeof DISTANCE_TO_THE_MOON_KM);
  11. console.log(typeof MILES_PER_KM);
  12. let milesToMars = DISTANCE_TO_MARS_KM * MILES_PER_KM;
  13. let hoursToMars = milesToMars / shuttleSpeed;
  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_THE_MOON_KM * MILES_PER_KM;
  17. let hoursToMoon = milesToMoon / shuttleSpeed;
  18. let daysToMoon = hoursToMoon / HOURS_PER_DAY;
  19. console.log(shuttleName + ' will take ' + daysToMoon.toFixed(2) + ' days to reach Moon')