In my Ionic app built with Angular 1.x, I am dealing with two arrays containing 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];
The common numbers in these arrays are 32 and 64.
I need a JavaScript solution that efficiently determines if there is at least one common number between the two arrays.
Below is the code snippet I have written:
angular.forEach(arr1 , function (arr1 , count) {
if ( inArray(arr1 , arr2) )
{
return true;
}
});