Advertisement
Zhaniartt

Untitled

Jan 24th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function reverseStringYes(arg){
  2.    
  3.     let username = arg[0];
  4.     let counter = 1;
  5.     let timesCount = 1;
  6.     let splitUsername = username.split("");
  7.     let reverseUser= splitUsername.reverse();
  8.     let joinUser = reverseUser.join("")
  9.     while(true){
  10.         let currentPass = arg[counter];
  11.        
  12.         if(joinUser == currentPass){
  13.             console.log(`User ${username} logged in.`)
  14.             break;
  15.         }
  16.         else{
  17.             console.log(`Incorrect password. Try again.`)
  18.             timesCount++;
  19.             if(timesCount == 4){
  20.                 console.log(`User ${username} blocked!`)
  21.                 return;
  22.             }
  23.         }
  24.         counter++;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement