[Solved] convert arrays to a single array of objects
If they are all in the same order, you can do this: var firstname = [“john”, “peter”, “rick”]; var age = [20, 45, 30]; var country = [“Brazil”, “USA”, “Italy”]; var array = []; for (var i = 0; i < firstname.length; i++) { array.push({firstname: firstname[i], age: age[i], country: country[i]}); } console.log( JSON.stringify(array) ); Note … Read more