How to append a smaller list of object in another main list after checking only those elements from the smaller list are getting appended which were not previously in main list. I have to do it in javascript.
Asked
Active
Viewed 58 times
1 Answers
0
Would something like the below work?
_.each($testArray, function ($item1){
var flag = false;
_.each($setArray, function ($item2){
if($item1 == $item2)
flag = true;
});
if(flag == false)
$setArray.push(item1);
});

gazzwi86
- 1,019
- 1
- 15
- 35