-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathwhile.js
More file actions
50 lines (38 loc) · 1.14 KB
/
while.js
File metadata and controls
50 lines (38 loc) · 1.14 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const READLINE = require("readline-sync");
/**** Problem 1 ****
Write a function that prints values from 10 to 0, counting down. Use a while
loop!
*/
function countdown() {
}
// Test below
//countdown();
/**** Problem 2 ****
Write a function that asks the user to enter a secret password. Until the user
enters the correct password, the program will keep asking for all eternity!
When they finally do enter the correct password, exit the loop and print a
congratulatory message.
*/
function getPassword() {
}
// Test below
//getPassword();
/**** Problem 3 ****
Enhance your function above to only allow the user to try entering the correct
password three times. If they fail three times, the program should kick them
out and tell them they are a robot. Otherwise it should give them the same
congratulatory message above.
*/
function getPasswordEnhanced() {
}
// Test below
//getPasswordEnhanced();
/**** Problem 4 ****
As a final enhancement, make it so when the user enters the wrong password, the
program tells them that they are wrong, along with how many attempts they
have left.
*/
function getPasswordFinal() {
}
// Test below
//getPasswordFinal() ;