JSFiddle - React, Tailwind, and code Playground

JavaScript

var firstArray = [1,2,3,4,5];
    var secondArray = [1,2,4,5];
    
    $.each(firstArray,function(i,firstArrayElement){
        $.each(secondArray,function(i,secondArrayElement){
            if(firstArrayElement === secondArrayElement) {
                // do stuff

                flag = true;
            }
        });
        if(typeof flag === 'undefined') console.log("Didn't find: "+firstArrayElement);
        delete flag;
    });