How is parent node property implemented in Java Script? | Sololearn: Learn to code for FREE!

+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 .

4/11/2021 2:30:28 PM

Mons Joseph

1 Answer

New 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.