Please help me i need you

Can you help me

I am a new learner and when i learned first lesson i found the mistake but i cant understand .TypeError: a.querySelectorAll(...).forEach is not a function .Please help me and please explain simply to me` . I'll really appreciate if you help!

Hello. it seems like the element value which you want to loop (with forEach function) is not an array type. Maybe do a double check or share your code.

2 Likes

This is correct; it still confuses me myself @quynh1732002, but this might help:

Can you please tell us what challenge you are working on and what your code is?

If I understand,your problem was when you tried to iterate through all elements you get from calling querySelectorAll by forEach.

You should know that querySelector returns NodeList, array like structure that doesn’t have built-in method forEach,map,filter etc.

What you need to do is to convert that NodeList into an array.

@Nina1012, NodeList has forEach() method:

@quynh1732002, we might need to see more code to debug :slight_smile:

1 Like

@snigo Thanks for the correction. :slight_smile:

I have this coming up in the Basic HTML and HTML5: Define the Head and Body of an HTML Document lesson

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.