forked from LaunchCodeEducation/javascript-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebuggingLogicErrors1.js
More file actions
32 lines (28 loc) · 852 Bytes
/
Copy pathDebuggingLogicErrors1.js
File metadata and controls
32 lines (28 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Run this sample code as-is and examine the output.
// Should the shuttle have launched?
// Did it?
// Do not worry about fixing the code yet, we will do that in the next series of exercises.
let launchReady = false;
let fuelLevel = 17000;
let crewStatus = true;
let computerStatus = 'green';
if (fuelLevel >= 20000) {
console.log('Fuel level cleared.');
launchReady = true;
} else {
console.log('WARNING: Insufficient fuel!');
launchReady = false;
}
if (crewStatus && computerStatus === 'green'){
console.log('Crew & computer cleared.');
launchReady = true;
} else {
console.log('WARNING: Crew or computer not ready!');
launchReady = false;
}
if (launchReady) {
console.log('10, 9, 8, 7, 6, 5, 4, 3, 2, 1...');
console.log('Liftoff!');
} else {
console.log('Launch scrubbed.');
}