You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This functions as intended. The comparison of duplicate values is a strict comparison. The two similar objects have the same value inside, but are not the same object.
As an example, internally it uses the unique method which by default compares with ===. Essentially the two objects {name:'Aron'} are not the same. If you type {name:'Aron'} === {name:'Aron'} into a console you will get false in return.
However, the union method should accept a comparison parameter which is a function that compares two arguments. The same way the union function does.
var old_users = [{name:'Adam'},{name:'Aron'},{name:'Bob'}];
var new_users = [{name:'Alan'},{name:'Aron'},{name:'Ben'}];
var total_users = array.union(old_users, new_users);
console.log(total_users); // [{name:'Adam'},{name:'Aron'},{name:'Bob'},{name:'Alan'},{name:'Aron'},{name:'Ben'}]
The text was updated successfully, but these errors were encountered: