Add ".childNodes[0]"

Hi all!

Is there a way to add “.childNodes[0]” to a var? Like if i have:

myVar = this.firstChild.childNodes[0].firstChild.nodeValue;

And if the user push a button I want myVar to be;

myVar = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;

Have a great day!