You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Alien Colors #1: Imagine an alien was just shot down in a game. Create a variable called alien_color and assign it a value of 'green', 'yellow', or 'red'.
• Write an if statement to test whether the alien’s color is green. If it is, print a message that the player just earned 5 points.
• Write one version of this program that passes the if test and another that fails. (The version that fails will have no output.)
*/
let alien_color = 'green'; // The alien is green
if (alien_color === 'green') {
console.log("The player just earned 5 points"); // This will be printed
}
let alien_color1 = 'yellow'; // The alien is yellow
if (alien_color1 === 'green') {
console.log("The player just earned 5 points");
}
// No output because the alien's color is not green