I'm currently struggling to use a forEach method to loop over an array with multiple objects in it. I might be making a silly mistake but im not sure where im going wrong with this
I have an object with some arrays like this...
assistants array:
var assistants =
[
{
"countryCode":"US",
"cityName":"San Diego",
"geographicRegionCode":"CA"
},
{
"countryCode":"AD",
"cityName":"a",
"geographicRegionCode":null
}
]
function im using to loop through and return a value...
function validateAssistants () {
angular.forEach(assistants, function(a) {
if(a.countryCode === "US") {
return true;
}
});
}
When i am going to debug...it keeps on saying that a is not defined. Not sure what i'm doing wrong. Can someone point me in the right direction?
"countryCode": "AD".No comma