var a1 = [1,2,3,4,5]; var a2 = [2,4]; alert(isSubset(a1, a2)); function isSubset(a1, a2) { return a2.every(function(element) { return a1.indexOf(element) !== -1; }); }