Get Nth child of a node using javascript oject

Hi i converted the below xml to json

I am suppose to select a node “b” whose position is the value of a variable, how to use the value of variable to test the position of a node?

<root> <a> <b>item</b> <b>item1</b> <b>item2</b> <b>item3</b> <b>item4</b> </a> </root>