nasqad,
Вариант не ловит повторы и ноль ....
function getIntersection(a, b) {
return a.filter(function (c) {
return b.indexOf(c) != -1 && c;
})
};
alert( getIntersection([0,-1,3,-4,5,2,6,3,3,3,3],[-1,0,8,1,2,9,3,-4,5,7,0]) )
function get(c, d) {
var a = {};
c.map(function (b) {
a[b] = !0
});
return a = d.filter(function (b) {
return a[b]? (a[b]=!1,!0):!1
})
};
alert( get([0,-1,3,-4,5,2,6,3,3,3,3],[-1,0,8,1,2,9,3,-4,5,7,0]) )