Skip to content

Instantly share code, notes, and snippets.

@MichaelStett
Created November 3, 2020 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelStett/e9666ec1c8dfab3f1f96c68e0d01c0ad to your computer and use it in GitHub Desktop.
Save MichaelStett/e9666ec1c8dfab3f1f96c68e0d01c0ad to your computer and use it in GitHub Desktop.
Script #3
const filterTodoList = (word) =>{
return todos.filter((item) => {
return item.desc.toLowerCase().includes(word.toLowerCase());
});
};
searchInput.addEventListener('input', (event) => {
event.preventDefault();
if (event.target.value.length >= 3){
arr = filterTodoList(event.target.value);
refreshTodoList(arr);
} else {
refreshTodoList(todos);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment