lundi 2 août 2021

My 2nd If-else conditional is printing the wrong output [duplicate]

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;
   crewStatus && computerStatus === 'BROWN';
}

if (crewStatus && computerStatus === 'green'){
   console.log('Crew & computer cleared.');
   launchReady = true;
} else {
   console.log('WARNING: Crew or computer not ready!');
   launchReady = false;
}

if (launchReady = false) {
   console.log('10, 9, 8, 7, 6, 5, 4, 3, 2, 1...');
   console.log('Liftoff!');
} else {
   console.log('Launch scrubbed.');
}

Please help me out. The 2nd If/else statement is giving the wrong output. It is printing the "if" conditional instead of the "else" conditional. I greatly appreciate your suggestions

Aucun commentaire:

Enregistrer un commentaire