Как проверить два значения массива разных длины равны в JavaScript

var a = [2, 4, 10];
var b = [1, 4];

var newArray = [];

for (var i = 0; i < a.length; i++) {
    // we want to know if a[i] is found in b
    var match = false; // we haven't found it yet
    for (var j = 0; j < b.length; j++) {
        if (a[i] == b[j]) {
            // we have found a[i] in b, so we can stop searching
            match = true;
            break;
        }
        // if we never find a[i] in b, the for loop will simply end,
        // and match will remain false
    }
    // add a[i] to newArray only if we didn't find a match.
    if (!match) {
        newArray.push(a[i]);
    }
}
Simman