Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 1
    For a simple object with a single property with a primitive value, this does indeed work. Try it with two arrays with objects with more than one property in different order (e.g. const a = [{ nome: 'Célio', age: 20 }]; const b = [{ age: 20, nome: 'Célio' }]) and you'll find it no longer works. This is discussed in several of the earlier answers that attempted the same trick (e.g. stackoverflow.com/a/52842903) Commented Aug 9, 2022 at 20:40
  • 1
    this wont work if the order of data on both array of objects are different. Commented Feb 1, 2023 at 12:07