Find Index where Two Arrays have same Value

If I have two arrays, in Javascript:

let arr1 = ["Dog", "Cat", "Monkey", "Zebra", "Goat", "Goose"];
let arr2 = ["Zebra", "Goat"];

How can I find the indexes of the larger array where there is a match and store them in another array so example output would be:

let indexes = [3,4]

16 thoughts on “Find Index where Two Arrays have same Value”

Leave a Comment