-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq27.ts
More file actions
21 lines (17 loc) · 712 Bytes
/
q27.ts
File metadata and controls
21 lines (17 loc) · 712 Bytes
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.
export default function q27(){
let alienColor:string = 'green';
if (alienColor === 'green') {
console.log('The player earned 5 points.');
} else if (alienColor === 'yellow') {
console.log('The player earned 10 points.');
} else if (alienColor === 'red') {
console.log('The player earned 15 points.');
} else {
console.log('Invalid alien color.');
}
}
q27();