Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login(input) {
- let username = input.shift();
- let password = input.shift();
- let output = "";
- let counter = 0;
- for (let j = 1; j <= 4; j++) {
- for (let i = username.length - 1; i >= 0; i--) {
- a = username.charCodeAt(i);
- output += `${String.fromCharCode(a)}`;
- output = output.trim();
- }
- if (password != output && counter<3) {
- console.log("Incorrect password. Try again.");
- } else if (password == output) {
- console.log(`User ${username} logged in.`);
- break;
- }
- if (counter == 3) {
- console.log(`User ${username} blocked!`);
- break;
- }
- counter++;
- output = "";
- password = input.shift();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement