123456789101112131415161718192021222324252627282930 |
- 'use strict'
-
- 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;
-
- let milesToMoon = DISTANCE_TO_MOON_KM * MILES_PER_KM;
- let hoursToMoon = milesToMoon / shuttleSpeedMph;
- let daysToMoon = hoursToMoon / HOURS_PER_DAY;
-
-
- console.log(shuttleName + ' will take ' + daysToMars.toFixed(2) + ' days to reach Mars ');
- /*
- console.log('${shuttleName} will take ${daysToMars} days to reach Mars'); kan ook.
- .toFixed() verandert de primitive value van daysToMars naar een object.
- */
- console.log(shuttleName + ' will take ' + daysToMoon.toFixed(2) + ' days to reach the Moon ');
|