A sample on how to compare two arrays :
Array.prototype.diff = function(a) {
return this.filter(function(i) {return a.indexOf(i) < 0;});
};
var a = ['b','c'];
var b = ['b','c','d','e','f'];
var temp = a.diff(b);
temp.length;
Credits : Nikhil
Array.prototype.diff = function(a) {
return this.filter(function(i) {return a.indexOf(i) < 0;});
};
var a = ['b','c'];
var b = ['b','c','d','e','f'];
var temp = a.diff(b);
temp.length;
Credits : Nikhil
No comments:
Post a Comment