searchBar. addEventListener (“keyup”, e)
Use the console.log function to check if the output you are getting is right.
Using the Filtering Option in the Search
To filter the search results that you have obtained, the filter() method has to be used. This allows iterating through the array and deciding whether it should be shown based on the search string. A sample code is:
Const filteredCharacters = x.filter ()
Instead of returning true, it can be used to include the searchString to get the desired results. To display the result use the displayCharacters() function. The code can then be tweaked to search for strings which is case insensitive too.