console.log(difference([1, 2, 3], [100, 2, 1, 10]));

function difference(ar1,ar2)
{
    var temp=[]
    for(var i =0 ;i <ar1.length ; i++)
    {
        for(var j = 0 ; j<ar2.length; j++)
        {
            if(ar1[i] == ar2[j])
            {
                temp.push(ar1[i])
                break
               
            }
            
        }
        
        
    }
    return temp;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: