---
title: "Discussion on \"Why does it return false when we compare two similar objects in JavaScript?\" | Hashnode"
description: "Discussion on \"Why does it return false when we compare two similar objects in JavaScript?\". To compare different objects with the same properties and values it returns false. So for comparison, we need to assign a reference variable to that object."
url: "https://hashnode.com/posts/why-does-it-return-false-when-we-compare-two-similar-objects-in-javascript/63f9cfd588a910637a22fd3c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why does it return false when we compare two similar objects in JavaScript?](https://heyvats.hashnode.dev/why-does-it-return-false-when-we-compare-two-similar-objects-in-javascript?utm_source=hashnode&utm_medium=feed)

To compare different objects with the same properties and values it returns false. So for comparison, we need to assign a reference variable to that object.

Feb 25, 2023 · 3 min read · heyvats.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#objects](https://hashnode.com/tag/objects)
-   [#arrays](https://hashnode.com/tag/arrays)
-   [#primitive-datatypes](https://hashnode.com/tag/primitive-datatypes)
-   [#non-primitive-datatypes](https://hashnode.com/tag/non-primitive-datatypes)

## Written by

[Vatsal Singh](https://hashnode.com/@heyvats)

@heyvats · Gwalior, Madhya Pradesh

  
[View profile](https://hashnode.com/@heyvats)

Tech Blogger

Hey, Everyone Hope you like my blog.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
