DEV Community

Discussion on: What is the best solution for removing duplicate Objects from an Array?

Collapse
 
vargavince91 profile image
Vince Varga

Hey Raffaele, Great post!

As this post is quite detailed and the main audience is people who learn JavaScript, I just wanted to mention about the JSON method that, for JSON. stringify() , the order matters.

JSON.stringify({id: 1, name: 'Jack'}) === JSON.stringify({id: 1, name: 'Jack'})
true
JSON.stringify({id: 1, name: 'Jack'}) === JSON.stringify({name: 'Jack', id: 1})
false

Though I'm sure you know it, it might be relevant to readers (or on the other hand, it might be too much information and out of scope for the article :))

Collapse
 
pixari profile image
Raffaele Pizzari

Thank you for pointing this out!

I'm sure it would be pretty useful for developers who are learning JS and aren't very confident with string comparison.

Thank you again :)