DEV Community

Discussion on: What’s your alternative solution? Challenge #28

Collapse
themobiledev profile image
Chris McKay • Edited on

So, here is my plain JavaScript solution:

var ar1 = [1, 2, 3, 10, 5, 3, 14];
var ar2 = [-1, 4, 5, 6, 14];

println(mergeLeft(ar1, ar2));

function mergeLeft(ar1, ar2) 
{
    return ar1.filter(e => !ar2.includes(e));
}