I am working in jQuery and I need to compare two arrays of strings which are as follows:
var A = ['dada','adad','a','s','rrrrrrrr'];
var B = ['dada','adad','a','s'];
C = [];
I need to compare those two arrays of strings and I need to get the difference, i.e the ‘rrrrrrr’ value after the compare.
$.each(A, function (i, e) {
if ($.inArray(e, B) == -1) C.push(e);
);
alert(C);
My output is:
C= r,r,r,r,r,r,r,r,r,r
However, I expected this output:
C=rrrrrrrrrr
Example: