I am using map to get the sub part of the array.
var mappingobj = {"custom":[{"head":"202","sub":["302","303"]},{"head":"203","sub":["102"]}],"spec":[]};
var subids = mappingobj.custom.map(function(o, i) {
if(o.head==202){
return o.sub;
}
});
console.log(subids);
I need to get only ["302","303"]. but i am getting the output as [Array[2], undefined].
Array#filter