Skip to content

Instantly share code, notes, and snippets.

@anshuraj
Last active October 26, 2018 09:15
Show Gist options
  • Save anshuraj/e0281360ecec4c69bc1a50580784a405 to your computer and use it in GitHub Desktop.
Save anshuraj/e0281360ecec4c69bc1a50580784a405 to your computer and use it in GitHub Desktop.
Javascript search in a list of string
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