i have array of objects, each object has unique id , want link multiple (sometimes hundreds) extensions object linked it's id.
here psuedo code example:
var objects = [ {id:15,name:"client john doe"}, {id:28,name:"server"} ] var extensions = [ 28:[ { name:"watch errors", command: "tail -f error.log" }, { name:"clear errors", command: "> error.log" } ] ]
this not valid javascript, best alternative create numeric associative array?
just use object literal instead of array:
var extensions = { 28: […] };
you can access extensions[28]
(or extensions["28"]
).