var userids = userbody.contacts.map(function(obj){
if((obj.iAccepted=='true')&&(obj.contactAccepted=='true')) {
console.log(true);
return obj.userID //return obj.userID
}
});
This will give the result like this:
[ '0', '35', '37', '30', '34', '36', '33', '32', undefined, '332', '328', '337', '333', undefined ]
I want to skip the undefined elements in the array.