Building A Password Checker

Lesson 22
Author : Afrixi
Last Updated : October, 2017


Table of Content

Code

Copyvar password = "wordpass";
var response;
var entryCount = 0;
var entryLimit = 3;
var error = false;

while(response != password && !error){
     if(entryCount < entryLimit){
          response = window.prompt("Enter Password");
          entryCount++;
     } else {
          error = true;
     }
}

if(error){
     alert("Too many entries");
} else {
     alert("Success");
}