JSFiddle - React, Tailwind, and code Playground
by Curt
JavaScript
var nodes = [{ID:"101", x:100, y:200}
,{ID:"102", x:200, y:200}
,{ID:"103", x:300, y:300}
,{ID:"104", x:200, y:300}];
function coordinates(ID){
var n;
for (i=0; i<nodes.length; i++){
var thisN = nodes[i];
if (thisN.ID==ID){
n = thisN;
break;
}
}
return {
x: n.x,
y: n.y
};
}
var c = coordinates("101");
alert(c.x);