I've got two arrays where:
var arrayX = ["02/01/2014", "14/10/2014", "03/05/2014"];
var arrayY = [2, 10, 8];
I want to create 3 different objects, each one being:
{x: "02/01/2014", y: 2}
{x: "14/10/2014", y: 10}
{x: "03/05/2017", y: 8}
and create an array containing all the 3 objects.
So my code is:
var data = [];
for (var i = 0; i < arrayX.length; i++){
var object = {x: arrayX[i], y: arrayY[i]};
data.push(object);
}
But the result that I get is an array with just an object containing three X and three Y: result
var result = [{x:["02/01/2014","14/10/2014","03/05/2017"], y:[2,10,8]}];
What can I do?