-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq31.ts
More file actions
21 lines (18 loc) · 718 Bytes
/
q31.ts
File metadata and controls
21 lines (18 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// No Users: Add an if test to Exercise 28 to make sure the list of users is not empty.
// • If the list is empty, print the message We need to find some users!
// • Remove all of the usernames from your array, and make sure the correct message is printed.
export default function q31() {
let usernames: string[] = []; // empty array
if (usernames.length === 0) {
console.log("We need to find some users!");
} else {
usernames.forEach(username => {
if (username === 'admin') {
console.log("Hello admin, would you like to see a status report?");
} else {
console.log(`Hello ${username}, thank you for logging in again.`);
}
});
}
}
q31();