I want to compare 2 arrays and check if the value of 3 given indexes is common between the 2 arrays. i.e.:
arr1 = [1,2,1,0,0,0,2,2,2]
arr2 = [0,0,0,0,0,0,2,2,2]
or
arr1 = [1,2,3,0,1,2,4,2,1]
arr2 = [1,0,0,0,1,0,0,0,1]
1st example here last 3 indexes are common. 2nd example here index 0,4,8 are common.
is there any method that can take the 2 arrays and return true if indexes are matching?
const data = arr1.map((item, i) => item > 0 && arr2[i] === item ? true : false );Eg: codepen.io/Maniraj_Murugan/pen/BawNvbX