Conditionals Javascript Homework


Javascript Popcorn Hack

Finish the else function in the program. Then run the code cell in the console to see if it works.

%%js 

let snakeDead = true;

if (snakeDead === false) {
    console.log("Continue game");
} else { 
    
}

Part C: JavaScript Practice

Here you will make a similar program as the Python program but in Javascript. Then change your program so that it prints:

  • “Excellent” if the score is ≥ 90

  • “Good” if the score is between 60 and 89

  • “Fail” if the score is below 60

%%js 

// <-- Example Code

let x = 19;

if (x >= 18) {
    console.log("You can vote");
} else {
    console.log("You are too young to vote");
}
%%js 

// Do the homework in this code cell