From a64c4d3fbe2775096cb4ff916b87fb83346d9556 Mon Sep 17 00:00:00 2001 From: scissorsneedfoodtoo Date: Thu, 16 Nov 2023 15:57:38 +0900 Subject: [PATCH] fix: convert resetDisplay function to arrow function, reorder code --- apps/pokemon-search-app/public/script.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/pokemon-search-app/public/script.js b/apps/pokemon-search-app/public/script.js index 95edb56ca..7ff8863aa 100644 --- a/apps/pokemon-search-app/public/script.js +++ b/apps/pokemon-search-app/public/script.js @@ -51,12 +51,7 @@ const getPokemon = async () => { } }; -searchForm.addEventListener('submit', e => { - e.preventDefault(); - getPokemon(); -}); - -function resetDisplay() { +const resetDisplay = () => { // reset to default display if pokemon is not found // reset image src and alt @@ -75,4 +70,9 @@ function resetDisplay() { specialAttack.innerHTML = ''; specialDefense.innerHTML = ''; speed.innerHTML = ''; -} +}; + +searchForm.addEventListener('submit', e => { + e.preventDefault(); + getPokemon(); +});