From 060f3d835ca293d4ee58eed61a4754c3c6f003d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=9C=20Junseo=20Kim?= Date: Tue, 6 Aug 2024 23:25:13 +0900 Subject: [PATCH] Update 1620.js --- "oesnuj/\355\225\264\354\213\234/1620.js" | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git "a/oesnuj/\355\225\264\354\213\234/1620.js" "b/oesnuj/\355\225\264\354\213\234/1620.js" index d78b8f5..3511f15 100644 --- "a/oesnuj/\355\225\264\354\213\234/1620.js" +++ "b/oesnuj/\355\225\264\354\213\234/1620.js" @@ -15,13 +15,12 @@ pokemonList.forEach((pokemon, index) => { let result = ''; testList.forEach(test => { - const num = Number(test); - if (!isNaN(num)) { + if (!isNaN(test)) { // 테스트 값이 번호인 경우 - result += pokemonList[num - 1] + '\n'; // 번호에 해당하는 Pokémon 이름 추가 + result += pokemonList[test - 1] + '\n'; // 번호에 해당하는 Pokémon 이름 추가 } else { // 테스트 값이 이름인 경우 result += pokemonMap.get(test) + '\n'; // 이름에 해당하는 Pokémon 번호 추가 } }); -console.log(result); \ No newline at end of file +console.log(result);