I’m making a project where i’m supposed to have an numpad to login users to their account. But i can’t really understand how I’m going to do that. The numpad from start displays “Enter your Account nnumber!”, and I want to make it understand that when it has got the correct account number, it should say “enter pin”. And if the pin is also correct it should log in and show the rest av the account. I’ve tried different stuff but i really cant make it do as i want. So if any of you got any help for me, I would be very greatful. I’m very novice to JS so the answer maybe is very simple but i don’t know.
type here
const users = [
{ accountNumber: '1337', pin: '1234', name: 'Mr Ibrahimovic', balance: 1000 },
{ accountNumber: '7331', pin: '5678', name: 'Mr Cooper', balance: 1000}
];
let islogin = false;
let whoIsLogin = -1;
let account = document.querySelector('.account');
account.style.display = 'none'
let bankomat = document.querySelector('.bankomat')
document.querySelector('.btn_login')
.addEventListener('click', () => {
bankomat.style.display = 'none'
account.style.display = 'block'
})
const screen = document.getElementById('screen');
const buttons = document.querySelectorAll('.btn');
console.log(buttons);
let numbers = '';
buttons.forEach(btn => {
btn.addEventListener('click', (e) =>{
numbers = numbers + e.target.value;
screen.innerHTML = numbers;
});
});