diff options
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r-- | public/javascripts/main.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js index aecf21f..b20ce6b 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -44,8 +44,8 @@ const users = getUsers() function getCurrentFav () { if (!window.localStorage.getItem('fav')) return const favCode = window.localStorage.getItem('fav').split(':') - const fav = users.filter(user => user.type === favCode[0] && user.index === Number(favCode[1]))[0] - return fav + const fav = users.filter(user => user.type === favCode[0] && user.index === Number(favCode[1])) + return fav[fav.length - 1] } function changeFav (isFav) { @@ -114,7 +114,7 @@ searchNode.addEventListener('submit', submitForm) function submitForm (e) { if (e) e.preventDefault() - if (results != null) { + if (results !== null) { const indexInResult = selectedResult === -1 ? 0 : selectedResult selectedUser = users[results[indexInResult].index] } |