Javascript – iterate array and populate with json data
I have the folowing code seriesTitles = ['depth','incline'] var aSeries = {name: '',data: [{}]} var seriesArray = [] seriesTitles.forEach(element => { // outer loop} aSeries.name = element; seriesArray.push(aSeries) }) console.log(seriesArray) But something is wrong. It seems to add the last…