Created
November 3, 2020 10:41
-
-
Save MichaelStett/e9666ec1c8dfab3f1f96c68e0d01c0ad to your computer and use it in GitHub Desktop.
Script #3
This file contains 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
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