javascript - Append Multiple objects into single array -
i have array of objects of structure coming server response of iterated array object sample
array[1] ={ "id": "123", "name": "john", "age": "15" } array[2] ={ "id": "456", "name": "sue", "age": "18" } array[n] ={ }
but want append array values if condition age below 18 in following structure of iterated values of above array expected output:
{ "stud": [{ "id": "123", "name": "john", "age": "15" }, { "id": "456", "name": "sue", "age": "18" },{n........ }] }
simply
var output = { "stud" : array }; //existing 'array'
Comments
Post a Comment