I am writing an Ionic app - so this is in Angular 1.x
I have two arrays of numbers:
var arr1 = [1,32,423,43,23,64,232,5,67,54];
var arr2 = [11,32,1423,143,123,64,2232,35,467,594];
There are two common numbers in the array 32, and 64.
I want some JavaScript to efficiently return true if there is at least 1 common number in the 2 arrays.
I have the following code
angular.forEach(arr1 , function (arr1 , count) {
if ( inArray(arr1 , arr2) )
{
return true;
}
});