marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
2.99k stars 790 forks source link

Add empty objects equality check #559

Closed harryghgim closed 2 years ago

marijnh commented 2 years ago

What problem with the existing code does this solve?

harryghgim commented 2 years ago

Hi. Thanks for reply.

When I was testing with the answer against a case where two empty objects are compared, I realised{} and [] comparison returned true. So I thought it'd be nice to cover that case as well and I made PR.

If the code addition is something small ok to be ignored as you deem, feel free to decline PR.

marijnh commented 2 years ago

Ah, I see what you mean. But I'd say it is okay if this returns true for {} and [], in order to keep the solution simple.