Fantastic! Finally I understood why carriage returns are text-nodes, because they are represented by the string " " 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!
I have a doubt. Kindly point out the error in the following code. let val; const list = document.querySelector('ul.collection'); val = list.children; val.forEach((values) => { console.log(values); });
@@SteveGriffith-Prof3ssorSt3v3 Thank you, just installed it. It's a very popular one too... Now, just a couple of formatting extensions for php and I will be good to ditch the phpstorm from next year :D
The biggest thing with `children` is that it is a live HTMLCollection. That means it changes as the DOM is altered and so will its length and the Array that you generate from it. Otherwise, yes Array.from( ) is a good way to extract a snapshot of the children.
@@SteveGriffith-Prof3ssorSt3v3 I've been using "for of" loops to iterate through HTML collections like this. Are there any notable advantages to the these different techniques? [].forEach.call(children) from your video, spread like this comment, or "for of"??
When working with HTML Collections I almost always use the Array methods map(), forEach(), filter( ), and so on. Mainly because they are easy to read and can be chained together - functional programming.
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.