var nodesXY = ['15% 15%','30% 16%','19% 42%','39% 80%',];
var number = ["0","1","2","3","4","0","0","0"];
//some loop
AccesNodes(number[1]);
function AccesNodes(number){
console.log(number);
//number = number;
var firstNode = nodesXY[number];
console.log(nodesXY[number]);
console.log(firstNode);
number++;
var secondNode = nodesXY[number];
console.log(nodesXY[number]);
console.log(secondNode);
number = number + 4;
var thirdNode = nodesXY[number];
console.log(nodesXY[number]);
console.log(thirdNode);
}
I don't understand why I'm not getting an undefined
when trying to access the "next node" with
var secondNode = nodesXY[number+1];
. How can I make this work correctly? I've looked for alternative solutions without success.