I have 2 arrays in javascript that you need to convert to a specific format, the current format of those 2 arrays is:
"diavalor": [
"15",
"27",
"44",
"63",
"-1",
"8",
"9",
"22"
],
"diafecha": [
"2018-08-30",
"2018-08-30",
"2018-08-30",
"2018-08-30",
"2018-08-30",
"2018-08-30",
"2018-08-30",
"2018-08-30"
]
and the format I need is:
var data = [
[1, 20],
[2, 40],
[3, 25],
[4, 45],
[5, 25],
[6, 50],
[7, 35],
[8, 60],
[9, 30]
];
and I do not know how to get to said format, I hope you can help me
update my problem is in the format because what I do:
var array=respuesta.humedad.diavalor;
for (i = 0; i < array.length; i++) {
data[i]=[[it,parseInt(array[i])]];
it+=1;
}
console.log(data);
console.log(data2);