Skip to content

Commit 42d696f

Browse files
committed
로그인 성공? / 기초
1 parent d7e9a27 commit 42d696f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
function solution(id_pw, db) {
2+
let queue = [...db];
3+
4+
const [id, pw] = id_pw;
5+
let hasId = false;
6+
7+
while(queue.length > 0) {
8+
const [dbId, dbPw] = queue.shift();
9+
10+
if(dbId === id) {
11+
hasId = true;
12+
if(dbPw === pw) {
13+
return "login";
14+
}
15+
}
16+
}
17+
18+
return hasId ? "wrong pw" : "fail";
19+
}

0 commit comments

Comments
 (0)