Advertisement
Didart

Password

Apr 9th, 2022
7,911
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function password(input) {
  2.     let index = 0;
  3.  
  4.     let userName = input[index];
  5.     index++;
  6.  
  7.     let password = input[index];
  8.     index++;
  9.  
  10.     let differentPassword = input[index];
  11.     index++;
  12.  
  13.     while (differentPassword !== password) {
  14.         differentPassword = input[index];
  15.         index++;
  16.     }
  17.  
  18. console.log(`Welcome ${userName}!`);
  19.  
  20. }
  21.  
  22. password(["Nakov", "1234", "Pass", "1324", "1234"])
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement