How is parent node property implemented in Java Script? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How is parent node property implemented in Java Script?

I'm just curious , as every node in DOM is an object and so is the root element Document, parent node property is what links them to their parents object. How is parent node property implemented in JavaScript ? A simple example code would be helpful...thnx .

11th Apr 2021, 2:30 PM
Mons Joseph
Mons Joseph - avatar
1 Answer
+ 2
The parentNode property is simply a reference to the parent. It's not the parent or a copy of it, it is just a 'reference' https://code.sololearn.com/cTBNNd10GoZi/?ref=app Of course, here we're talking about references. But most browser engines are implemented in C++, so you can imagine how the the parentNode property is a pointer to the parent.
11th Apr 2021, 3:22 PM
XXX
XXX - avatar