1234567891011121314151617181920212223242526 |
- let shuttleName = 'Determination';
- let shuttleSpeedMph = 17_500;
- const DISTANCE_TO_MARS_KM = 225_000_000;
- const DISTANCE_TO_MOON_KM = 384_400;
- const MILES_PER_KM = 0.621;
- const HOURS_PER_DAY = 24;
-
- console.log(typeof shuttleName);
- console.log(typeof shuttleSpeedMph);
- console.log(typeof DISTANCE_TO_MARS_KM);
- console.log(typeof DISTANCE_TO_MOON_KM);
- console.log(typeof MILES_PER_KM);
-
- let milesToMars = DISTANCE_TO_MARS_KM * MILES_PER_KM;
- let hoursToMars = milesToMars / shuttleSpeedMph;
- let daysToMars = hoursToMars / HOURS_PER_DAY;
-
- //console.log(shuttleName + " will take " + daysToMars + " days to reach Mars");
- console.log(`${shuttleName} will take ${daysToMars.toFixed(2)} days to reach Mars`);
-
- let milesToMoon = DISTANCE_TO_MOON_KM * MILES_PER_KM;
- let hoursToMoon = milesToMoon / shuttleSpeedMph;
- let daysToMoon = hoursToMoon / HOURS_PER_DAY;
-
- //console.log(shuttleName + " will take " + daysToMoon + " days to reach Moon");
- console.log(`${shuttleName} will take ${daysToMoon.toFixed(2)} days to reach Moon`);
|