Skip to content

Commit

Permalink
completed exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
Sthom0121 committed Jan 12, 2024
1 parent abe8c86 commit 22ac3d7
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions data-and-variables/exercises/data-and-variables-exercises.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
// Declare and assign the variables below
let shuttleName = 'Determination';
let shuttleSpeedMph = 17500;
let distanceToMarsKm = 225000000;
let distanceToMoonKm = 38400;
const milesPerKm = 0.621;

// Use console.log to print the 'typeof' each variable. Print one item per line.

console.log (typeof 'shuttleName');
console.log (typeof 'shuttleSpeedMph');
console.log (typeof 'distanceToMarsKm');
console.log (typeof 'distanceToMoonKm');
console.log (typeof 'milesPerKm');
// Calculate a space mission below

let milesToMars = distanceToMarsKm * milesPerKm;
let hoursToMars = milesToMars / shuttleSpeedMph;
let daysToMars = hoursToMars / 24;
// Print the results of the space mission calculations below

console.log (shuttleName +" will take "+ daysToMars +" days to reach Mars.");
// Calculate a trip to the moon below

// Print the results of the trip to the moon below
let milesToMoon = distanceToMoonKm * milesPerKm;
let hoursToMoon = milesToMoon / shuttleSpeedMph;
let daysToMoon = hoursToMoon / 24;
// Print the results of the trip to the moon below
console.log(shuttleName + " will take " + daysToMoon + " days to reach the Moon.");

0 comments on commit 22ac3d7

Please sign in to comment.