What is the Difference Between children and childNodes?

preview_player
Показать описание
When starting out with the DOM and JavaScript there can be many subtle differences between properties that make it confusing and give you unpredictable results.
This tutorial aims to help to clarify the difference between `children` and `childNodes`.

Рекомендации по теме
Комментарии
Автор

Fantastic! Finally I understood why carriage returns are text-nodes, because they are represented by the string "\r" I guess. It's true this is quite confusing for a beginner like me, because we are bombarded with everything at the same time: memorizing syntax, remembering methods and property names etc. It's just becomes overwhelming and frustrating sometimes. But then there are moments like these of momentary enlightenement! I love your work!

kllokoq
Автор

Thanks for great JS tutorials. Most in-depth ones on youtube.

paulgz
Автор

Hi I found it really cool that the whitespace is a text child.

EDC.EveryDayCode
Автор

Excellent as always
Keep up the good work

flybon
Автор

I have a doubt. Kindly point out the error in the following code.
let val;
const list =
val = list.children;
val.forEach((values) => {
console.log(values);
});

nikhilupadhyay
Автор

Thanks Steve. I think it is possible to use Array.from or spread on children like this

tahasoft
Автор

Hi,
What theme do you use? I really like the dots and colored tabs used for indentation.

waheed
Автор

Sir, i love your content. But this topic can be explained in a more simplified way.but i find your explanation little complex(respect to the topic).
Don't mind. It's just an opinion of me.

suvendudas