Here's my input
var id = '1,2,3';
var name = 'a,b,c';
var value = 'x,y,z';
How can i construct a array like this
[
{
"id" : "1",
"name" : "a",
"value" : "x",
}
,
{
"id" : "2",
"name" : "b",
"value" : "y",
}
,
{
"id" : "3",
"name" : "c",
"value" : "z",
}
]
I tried like this
var newArray = [];
newArray.push({'id':id,'name':name,'value':value })
But it gives, a single array with comma seperated value.
How can i do this Pls help
Note : I prefer only javascript