function solution(id_pw, db) {
let answer = 'fail';
db.some((data) => {
if (data[0] === id_pw[0]) {
if (data[1] === id_pw[1]) {
answer = 'login'
} else {
answer = 'wrong pw'
}
}
});
return answer;
}
function solution(id_pw, db) {
const [id, pw] = id_pw;
const map = new Map(db);
return map.has(id) ? (map.get(id) === pw ? 'login' : 'wrong pw') : 'fail';
}