I ask my question differently :
I'm using angular/Javacript and i want to know if a value exist in an array or not. Here's my code :
var source = [1, 2, 3 , 4 , 5];
var cities = [{ city: 4 }, { city: 6 }, { city: 8 }];
angular.forEach(source, function (value, key) {
if (cities["city"].indexOf(value) != -1) {
console.log(value+ " exist"); }
else{ console.log(value+ " not exist"); }
});
but the cities["city"] is not undefined. Any help ?