Hi guys, just wondering if someone would be kind enough to help me understand how this bit of javascript works below.
function findChild (element, nodeName)
{
var child;
for (child = element.firstChild; child != null; child = child.nextSibling)
{
if (child.nodeName == nodeName)
return child;
}
return null;
}
I know what it basically does, but im having trouble running it through in my head clearly, as in talk it through too myself. Its apart of XML feed parser for a RSS widget i’m learning.
The for loop is what is confusing me I guess, specifically the variable and incrementing factor (child=child.nextSibling).
Any help would be greatly appreciated.
Thanks in advance.
Legion.