Last active
October 26, 2018 09:15
-
-
Save anshuraj/e0281360ecec4c69bc1a50580784a405 to your computer and use it in GitHub Desktop.
Javascript search in a list of string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
search = (list, searchQuery) => { | |
var updatedList = list; | |
updatedList = updatedList.filter(function (item) { | |
return item.toLowerCase().search( | |
searchQuery.toLowerCase()) !== -1; | |
}); | |
return updatedList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment