-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex_27.js
21 lines (21 loc) · 853 Bytes
/
ex_27.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Alien Colors #3: Turn your if-else chain from Exercise 5-4 into an if-else chain.
// • If the alien is green, print a message that the player earned 5 points.
// • If the alien is yellow, print a message that the player earned 10 points.
// • If the alien is red, print a message that the player earned 15 points.
// • Write three versions of this program, making sure each message is printed for the appropriate color alien.
// let aleinColor = "red";
// let aleinColor = "yellow";
// let aleinColor = "green";
var aleinColor = "no color";
if (aleinColor == "green") {
console.log("The player earned 5 points");
}
else if (aleinColor == "yellow") {
console.log("The player earned 10 points");
}
else if (aleinColor == "red") {
console.log("the player earned 15 points");
}
else {
console.log("the player earned 0 points");
}