JavaScript: How to match array values with each occurrence and not with all the matches
I have two arrays: const array1 = ["A", "S", "S", "G"]; // multiple occurrences of 'S'. const array2 = ["S", "F", "J", "A"]; // single occurrence of 'S'. I want to match the array2 with array1 for each of the…