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