`// Search Chat
const searchMessage = () => {
const val = messageSearch.value.toLowerCase();
message.forEach(chat => {
let n...
For further actions, you may consider blocking this person and/or reporting abuse
I don't think anyone can actually solve your question but some advices can be given
?
to access properties only when the variable is defined, otherwise you can check with anif(varName) ...
. Most probably the queries you used didn't find the elements or are not accessible as you expected.Can you just told me where i put the ? in my code?
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!
Looks like you haven't defined the message variable.
this is the complete error
const message = messages.querySelectorAll(".message");
//this is the variable bro
yeah what the issue for full stack web developer? Bro kindly explain your thought if Anything wrong i written?
Why you asking your self am i kidding?
You right but you know some time small bugs eat big time..
That's way... And i fix the problem bro
Think this post lacks a significant amount of explanation. There is no frame of reference for the code posted or how it relates to the error.
what can i do bro?
AR!F, try to imagine why you like reading other people their blogs on dev.to.
Most blogs start with a takeaway that grabs you into a story and defines the problem Afer that you can come up with a solution (your snippet).
After that you can maybe give an outro/elaborate of what you conclusions were and what you would have done better.
Currently just pasting a snippet isn't defined as a "blog" but belongs on gist.github.com 😀 It just looks lazy or too easy 🙃