SHARE
TWEET

Untitled

a guest Jan 26th, 2019 121 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function reverseString(username) {
  2.     let user = username[0];
  3.     let user2 = user.split("").reverse().join("");;
  4.     let counter = 0;
  5.  
  6.     while (true){
  7.         let pass = username[0];
  8.         if (pass === user2){
  9.             console.log(`User ${user} logged in.`);
  10.             break;
  11.         } else {
  12.             console.log("Incorrect password. Try again.");
  13.             counter++;
  14.         }
  15.  
  16.         if (counter >= 3){
  17.             console.log(`User ${user} blocked!`);
  18.             break;
  19.         }
  20.     }
  21.    
  22. }
  23. reverseString(['Acer','login','go','let me in','recA']);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top