3 ms·
> JavaScript “How can I merge two JavaScript objects and remove any duplicates” (This is a genuine question) Is it hard to find a solution to that question on
by logifail 4y ago
> JavaScript “How can I merge two JavaScript objects and remove any duplicates”
(This is a genuine question) Is it hard to find a solution to that question on the web by using a search engine?
- ericmcer 4y agoIt would be difficult to search because that is a weird question. If you asked a more practical question like "merge two arrays and remove duplicate values" you would find tons of exact results.
- catlifeonmars 4y agoYeah this question is confusing without more context, because that is already how JavaScript objects work by default. If you assign multiple times to one key, only the latest assignment is preserved. It’s more complicated (though not much more) to merge two JavaScript objects while preserving duplicates.