I have two arrays as below:
var arr1 = [1,2,3,8,7,5,7,2,9,0];
var arr2 = [8,7,5];
I want to compare arr2
with arr1
, when it will find arr2
exactly in the same sequence as it is then it should return true
. i.e. if [8,7,5]
is found exactly same sequence in arr1
then it will return true
.
Note:
We have to do this without using indexOf
.