-
Notifications
You must be signed in to change notification settings - Fork 0
/
Question27.js
34 lines (34 loc) · 1.11 KB
/
Question27.js
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
33
34
"use strict";
// Set the alien_color variable to either 'green', 'yellow', or 'red'
let alien_color = 'green';
// If-else chain to determine the points earned based on the alien's color
if (alien_color === 'green') {
console.log("The player earned 5 points!");
}
else if (alien_color === 'yellow') {
console.log("The player earned 10 points!");
}
else if (alien_color === 'red') {
console.log("The player earned 15 points!");
}
// A version of the program for each color of alien
alien_color = 'yellow'; // change the value to 'yellow'
if (alien_color === 'green') {
console.log("The player earned 5 points!");
}
else if (alien_color === 'yellow') {
console.log("The player earned 10 points!");
}
else if (alien_color === 'red') {
console.log("The player earned 15 points!");
}
alien_color = 'red'; // change the value to 'red'
if (alien_color === 'green') {
console.log("The player earned 5 points!");
}
else if (alien_color === 'yellow') {
console.log("The player earned 10 points!");
}
else if (alien_color === 'red') {
console.log("The player earned 15 points!");
}