I am faced with the task of setting the seqNo
property in one JSON object, b
, based on the id from another JSON object, a
. How can I achieve this?
var a = [{id: "Make", seqNo: 4},
{id: "Model", seqNo: 1},
{id: "XModel", seqNo: 2},
{id: "Rate", seqNo: 3},
{id: "Price", seqNo: 0}];
var b = [
{id: "Make", field: "make", seqNo: setvalue},
{id: "Model", field: "model", seqNo: setvalue},
{id: "XModel", field: "model", seqNo: setvalue},
{id: "Rate", field: "price", seqNo: setvalue},
{id: "Price", field: "price", seqNo: setvalue}
];
output:-
var c = [
{headerName: "Make", field: "make", seqNo: 4},
{headerName: "Model", field: "model", seqNo: 1},
{headerName: "XModel", field: "model", seqNo: 2},
{headerName: "Rate", field: "price", seqNo: 3},
{headerName: "Price", field: "price", seqNo: 0}
];