title: Javascript array creation error
body: <p>I'm new to Javascript. I want to create an array like this from my API data.
  This is what I want.</p>
  
  <pre><code>let consumptionDay2 = [
    {
      data: [
        { x: "0", y: 33 },
        { x: "1", y: 55 },
        { x: "2", y: 66 },
        { x: "3", y: 550 },
        { x: "4", y: 23 },
        { x: "5", y: 346 },
        { x: "6" ,y: 56 },
        { x: "7", y: 87 },
        { x: "8", y: 675 },
        { x: "9", y: 432 },
        { x: "10", y: 234 },
        { x: "11", y: 765 }
      ]
    }
  ] 
  </code></pre>
  
  <p>This is what I tried. </p>
  
  <pre><code>let tempLineChart = []
  let LineChartData;
  
  for (j = 0; j &lt; consumptionData.length; j++) {
    let tempconsumptionData = {}    
    tempconsumptionData["x"] = consumptionData[j].time
    tempconsumptionData["y"] = consumptionData[j].powerFactor
    tempLineChart.push(tempconsumptionData)
  }
  
  LineChartData= {data: tempLineChart};
  lineChart.push(LineChartData)
  </code></pre>
  
  <p>Could anyone please help me to make this as above model.</p>