I am in need of prompt assistance on how to integrate my array into a for loop.
Currently, my graph accepts the following as nodes:
var classes = [
{"name":"test.cluster1.item1"},
{"name":"test.cluster1.item2"},
{"name":"test.cluster1.item3"}
];
I also have a separate functional array named fileArray, which contains multiple nodes that I wish to include in my graph.
var fileArray = ["a", "b", "c", "etc..."];
I am attempting to replace all instances of "test cluster items" in my data with each element of fileArray. How should I go about achieving this?
The code snippet I currently have doesn't seem logical, and I am at a loss on how to proceed.
for(i = 0; i < fileArray.length; i++) {
var classes = [
{"name": fileArray(i)}
];
}
Desired outcome:
var classes = [
{"name":"fileArray[0]"},
{"name":"fileArray[1]"},
{"name":"fileArray[2]"},
{"name":"fileArray[3]"},
{"name":"fileArray[4]"}
];
Thank you.