Nothing here yet.
Nothing here yet.
No blogs yet.
The function nest() takes two parameters 1) el and 2) parent. The first time nest is called we pass a (first element of the array) and root to the function. Nest() creates a new object called node. Node then gets added to the parent parameter. Parent corresponds to root the first time the function is called. Then node is returned. A reference of node is actually returned and not a copy (THIS IS IMPORTANT). Therefore, when nest() gets called a second time the parent parameter is actually a reference to the first node object that was created in the previously called nest() function.