154k views
1 vote
Write a program that uses a loop and a half to prompt a user for a password. If they get it correct, break out of the loop. If not, give them an error message. (JavaScript)

a) Prompt user
b) Break out of loop
c) Error message
d) All of the above

User Anji R
by
8.0k points

1 Answer

6 votes

Final answer:

The correct option is d) All of the above. The program needs to use a loop and a half to prompt the user for a password. It should continue prompting the user until they enter the correct password. Once the correct password is entered, the program should break out of the loop using the break statement. If the user doesn't enter the correct password, an error message should be displayed.

Step-by-step explanation:

The correct option is d) All of the above. The program needs to use a loop and a half to prompt the user for a password. It should continue prompting the user until they enter the correct password. Once the correct password is entered, the program should break out of the loop using the break statement. If the user doesn't enter the correct password, an error message should be displayed.

User Heavyd
by
8.1k points