I formatted your code a bit.
I do not know what messageSearch represents and if it can be undefined. If it can then add ? wheneve you try to use one of it's properties. Same for message.
Also if message is an array you should rename it to messages
The error is only a printscreen. You can click the error message and check which line has problems.
From what I can see any variable you should typecheck each variable that deals with a query selector. I can only guess that some of those elements are not always on screen.
Also as a tip you should name anything that is an array with something meaningful, in your case 'messages' should be called 'messageElement' or something while 'message' should be 'messages' or 'messageArray' since the queryAll should return an array.
I formatted your code a bit.
I do not know what
messageSearch
represents and if it can be undefined. If it can then add?
wheneve you try to use one of it's properties. Same formessage
.Also if
message
is an array you should rename it tomessages
//here whole variable
const messages = document.querySelector(".messages");
const message = messages.querySelectorAll(".message");
const messageSearch = document.querySelector("#messages-search");
//and this is complete error massage bro kindly check the error massage
dev-to-uploads.s3.amazonaws.com/up...
The error is only a printscreen. You can click the error message and check which line has problems.
From what I can see any variable you should typecheck each variable that deals with a query selector. I can only guess that some of those elements are not always on screen.
Also as a tip you should name anything that is an array with something meaningful, in your case 'messages' should be called 'messageElement' or something while 'message' should be 'messages' or 'messageArray' since the queryAll should return an array.
//here the line of error but i don't understand why error show
//just check this image bro
dev-to-uploads.s3.amazonaws.com/up...
I checked the code
The problem is that you use querySlectorAll ehich returns an array, while the textContent can be used only on an element
Thanks men!