Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input){
- let username = input[0],
- counter = 0,
- password = "";
- for(let i = 1; i< input.length; i +=1){
- password = input[i].split("").reverse().join("");
- if(username !== password){
- counter += 1;
- if(counter === 4){
- console.log(`User ${username} blocked!`);
- break;
- }
- console.log('Incorrect password. Try again.');
- }
- else{
- console.log(`User ${username} logged in.`);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement