var array1 = ['12','1','10','19','100','test'];
var array2 = ['12','10','19','test1'];
var array3 = array1.filter(function(obj) { return array2.indexOf(obj) == -1; });
var array4 = array2.filter(function(obj) { return array1.indexOf(obj) == -1; });
gs.print('----> array1 Values----->'+ array1);
gs.print('----> array2 Values----->'+ array2);
gs.print('----> array3 Values----->'+ array3);
gs.print('----> Concat Values----->'+ array3.concat(array4));
Reference:
https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items
Very nice article,keep sharing it more.
ReplyDeleteThank you.
ServiceNow Online Training Hyderabad