Using this code...
var a = [\'volvo\',\'random data\'];
var b = [\'random data\'];
var unique = $.grep(a, function(element) {
return $.inArray(element, b
You could just iterate over a and use Array.prototype.indexOf to get the index of the element in b, if indexOf returns -1 b does not contain the element of a.
var a = [...], b = [...]
a.forEach(function(el) {
if(b.indexOf(el) > 0) console.log(b.indexOf(el));
else console.log("b does not contain " + el);
});