I have an array looking like this:
var testArray = [
{"cid": "1234567"},
{"cid": "892345"},
{"cid": ""},
{"cid": "8267783"},
{},
{"cid": "096873"},
];
How do I remove, either before a for loop or when looping, where cid = "" and where is empty {}
I tried this:
for(var i = 0; testArray.length; i++){
if(testArray.cid && testArray.cid != ""){
}
}
This didn't work :-/ Got this error: Cannot read property "cid" from undefined
Hope this makes sense and thanks in advance :-)
indexof itemif( testArray[i].cid )