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.

solution.js 1018B

1234567891011121314151617181920212223242526
  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 + " days to reach Mars");
  16. console.log(`${shuttleName} will take ${daysToMars.toFixed(2)} days to reach Mars`);
  17. let milesToMoon = DISTANCE_TO_MOON_KM * MILES_PER_KM;
  18. let hoursToMoon = milesToMoon / shuttleSpeedMph;
  19. let daysToMoon = hoursToMoon / HOURS_PER_DAY;
  20. //console.log(shuttleName + " will take " + daysToMoon + " days to reach Moon");
  21. console.log(`${shuttleName} will take ${daysToMoon.toFixed(2)} days to reach Moon`);