April 1, 2022 06:54 pm GMT
Original Link: https://dev.to/arif0ne/how-to-solve-uncaught-typeerror-cannot-read-properties-of-undefined-in-javascript-1789
How to solve "Uncaught TypeError: Cannot read properties of undefined" in Javascript
`// Search Chat
const searchMessage = () => {
const val = messageSearch.value.toLowerCase();
message.forEach(chat => {
let name = chat.querySelectorAll("h5").textContent.toLowerCase();
if (name.indexOf(val) != -1) {
chat.style.display = "flex";
} else {
chat.style.display = "none";
}
});
}
//Search Message
messageSearch.addEventListener("keyup", searchMessage);`
Original Link: https://dev.to/arif0ne/how-to-solve-uncaught-typeerror-cannot-read-properties-of-undefined-in-javascript-1789
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To