is there an AngularJS way of checking if a value exists in an array
var array1 = ["a","b","c"]
i'm trying to do this..
var array2 = ["c", "d", "e"]
angular.forEach(array2, function (a) {
if (a /*is NOT in array1*/) {
array1.push(a);
} else {
return false
}
});
https://www.w3schools.com/jsref/jsref_includes_array.asp
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var n = fruits.includes("Mango");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With