So I attempting to do a JS search thing (I have posted about it before...). I have an array of objects with info about football teams what I would like to do is be able to enter a team to seach for and if search name matches one of the teams show the relevant info about that team.
So far I have EventListener on the input to get the search value and created an array of the team names to match against. I have that removed the football club from the strings using replace, but I would like to further reduce the strings further and remove words from the strings as although some teams have united or city etc in their names it is not how they are usually referred to, although some do need to have that included.
I have looked through MDN and the list of array methods but not sure if the best way to approach it as some teams need that part of the name and others don't. Could it be splice? As the teams are listed alphabetically so I can get the index value and use that to target but could I use that for multiple teams/words?
Also to get the other info and display for the team that matched the search term I figure I want a for loop to go through the original teams array but not sure how it ties up with the other teamNames array I have created?
Any help appreciated... I think I understand the relevant bits as ever it tyings them all together I'm having difficulty with.