array method to check if index value between two arrays exists in JS


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?

Source: JavaSript – Stack Overflow

December 3, 2021
Category : News
Tags: arrays | javascript

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.