I have 3 Javascript arrays:
array1 = ["data", "data1", "data2"] array2 = ["data", "data1", "data2"] array3 = ["data", "data1", "data2"] How can I combine them all, so that I can simply run a single loop and retrieve values from them.
for (let index = 0; index < mainArray.length; index++) { value1 = mainArray.array1[index]; value2 = mainArray.array2[index]; value3 = mainArray.array3[index]; } How can I create a the mainArray to accommodate all three javascript arrays, can a complex object or json object be created?
let main = [...array1, ...array2, ...array3]