Skip to content

Commit 810892c

Browse files
author
ZeroSigns
committed
Calculated a space mission
1 parent 9e88293 commit 810892c

16 files changed

Lines changed: 3807 additions & 6 deletions

File tree

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
// Declare and assign the variables below
2-
2+
let shuttleName = 'Determination';
3+
let shuttleSpeedMph = 17500;
4+
let distanceToMarsKm = 225000000;
5+
let distanceToMoonKm = 38400;
6+
const milesPerKm = 0.621;
37
// Use console.log to print the 'typeof' each variable. Print one item per line.
4-
8+
console.log(typeof shuttleName);
9+
console.log(typeof shuttleSpeedMph);
10+
console.log(typeof distanceToMarsKm);
11+
console.log(typeof distanceToMoonKm);
12+
console.log(typeof milesPerKm);
513
// Calculate a space mission below
6-
14+
let milesToMars = 225000000 * 0.621;
15+
console.log(milesToMars);
16+
let hoursToMars = 139725000 / 17500;
17+
console.log(hoursToMars);
18+
let daysToMars = 7984.285714285715 / 24;
19+
console.log(daysToMars);
720
// Print the results of the space mission calculations below
8-
21+
"Determination will take 332.67857142857144 days to reach Mars."
922
// Calculate a trip to the moon below
10-
11-
// Print the results of the trip to the moon below
23+
let milesToMoon = 38400 * 0.621;
24+
console.log(milesToMoon);
25+
let hoursToMoon = 23846.4 / 17500;
26+
console.log(hoursToMoon);
27+
let daysToMoon = 1.3626514285714286 / 24;
28+
console.log(hoursToMoon);
29+
// Print the results of the trip to the moon below
30+
"Determination will take 1.3626514285714286 days to reach the Moon."

data-and-variables/exercises/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

how-to-write-code/Comments.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
comments. */
1111

1212
console.log("Comments make your code more readable by others.");
13+
const input = require('readline-sync');
14+
let name = input.question('What is your name: ');
15+
console.log("Hello " + name);

how-to-write-code/node_modules/.package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

how-to-write-code/node_modules/readline-sync/LICENSE

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

how-to-write-code/node_modules/readline-sync/README-Deprecated.md

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)