0
1.5kviews
JavaScript Program for guessing the username and password in 5 attempts.

Write a JavaScript program that prompts for the username and password individually.

Provides five chances to guess the correct username and password for each one.

The correct username is "admin" and the password is "admin12345".

If the username and password are correct it will display on the screen how many tries the user made to guess the correct password otherwise it will display how many tries the user has left to guess the correct password.

If the correct username is entered in 5 attempts then only the program will ask for the password otherwise not.

In 5 attempts correct username is not guessed then the program will terminate there only.

1 Answer
0
25views

The Javascript Program

  • The below javascript program first ask username from the user.

  • The program gives 5 chances to the user to guess the correct username.

  • If the user gives the wrong username then the program prompts the user they entered the wrong username and the chances remain to guess …

Create a free account to keep reading this post.

and 4 others joined a min ago.

Please log in to add an answer.