<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/why-are-two-similar-objects-not-equal-in-javascript--t431rdugc" -->

---
title: Why are two similar objects not equal in JavaScript?
description: In JavaScript, two objects cannot be equal even though they are similar in JavaSCript. In the case of objects, you are comparing the references (the addresses)...
canonical: https://daily.dev/posts/why-are-two-similar-objects-not-equal-in-javascript--t431rdugc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Why are two similar objects not equal in JavaScript? | daily.dev
og:description: In JavaScript, two objects cannot be equal even though they are similar in JavaSCript. In the case of objects, you are comparing the references (the addresses)...
og:url: https://daily.dev/posts/why-are-two-similar-objects-not-equal-in-javascript--t431rdugc
og:image: https://api.daily.dev/og/posts/t431RDugc.png
og:image:alt: Why are two similar objects not equal in JavaScript?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Why are two similar objects not equal in JavaScript?

**[freeCodeCamp](https://daily.dev/sources/freecodecamp)** · [@dillionmegida](https://daily.dev/dillionmegida) · 4 min read · 158 upvotes · 11 comments

## Summary

In JavaScript, two objects cannot be equal even though they are similar in JavaSCript. In the case of objects, you are comparing the references (the addresses) and not the exact values.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.freecodecamp.org/news/why-are-two-similar-objects-not-equal-in-javascript/>

## Community discussion

Top comments from developers on daily.dev.

**@jankry** · 1 upvotes

> This is great and simple explanation! Thank you.

**@tatacsd** · 0 upvotes

> 👏🏻👏🏻👏🏻

**@alsiam** · 0 upvotes

> Thanks for sharing..!

**@xuanmai** · 0 upvotes

> They're stored on different heap memory addresses.

**@mikeb275** · 0 upvotes

> Nice

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 1 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/why-are-two-similar-objects-not-equal-in-javascript--t431rdugc)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Why are two similar objects not equal in JavaScript?","url":"https://daily.dev/posts/why-are-two-similar-objects-not-equal-in-javascript--t431rdugc","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/why-are-two-similar-objects-not-equal-in-javascript--t431rdugc"},"datePublished":"2023-07-18T21:17:53.468Z","dateModified":"2023-07-20T14:10:56.027Z","description":"In JavaScript, two objects cannot be equal even though they are similar in JavaSCript. In the case of objects, you are comparing the references (the addresses)...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/eea27b45e9373e0140e9914481fcea88?_a=AQAEufR","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/eea27b45e9373e0140e9914481fcea88?_a=AQAEufR","isAccessibleForFree":true,"articleSection":"freeCodeCamp","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Dillion Megida","url":"https://daily.dev/dillionmegida","image":"https://lh3.googleusercontent.com/a-/AOh14GhsdJDVct4Ey9D1H1iIIksJ7CSThh8JBubqfjbp4lM=s100","description":"Developer Advocate and Content Creator passionate about simplifying tech via videos and articles and also sharing my life and career experiences.","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":450}},"commentCount":11,"discussionUrl":"https://daily.dev/posts/why-are-two-similar-objects-not-equal-in-javascript--t431rdugc","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":158},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":11}],"keywords":"javascript","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"freeCodeCamp","item":"https://daily.dev/sources/freecodecamp"},{"@type":"ListItem","position":3,"name":"Why are two similar objects not equal in JavaScript?"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/why-are-two-similar-objects-not-equal-in-javascript--t431rdugc","comment":[{"@type":"Comment","text":"This is great and simple explanation! Thank you.","datePublished":"2023-07-26T05:17:34.202Z","url":"https://daily.dev/posts/t431RDugc#c-RYHFwCF9T","author":{"@type":"Person","name":"Jan Kry","url":"https://daily.dev/jankry","image":"https://avatars.githubusercontent.com/u/47389347?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"👏🏻👏🏻👏🏻","datePublished":"2023-07-25T16:54:01.179Z","url":"https://daily.dev/posts/t431RDugc#c-yhJrtPraz","author":{"@type":"Person","name":"Thays Casado","url":"https://daily.dev/tatacsd","image":"https://avatars.githubusercontent.com/u/29147847?v=4"}},{"@type":"Comment","text":"Thanks for sharing…!","datePublished":"2023-08-04T14:44:28.311Z","url":"https://daily.dev/posts/t431RDugc#c-huz3Ka10Y","author":{"@type":"Person","name":"Saif Al Siam","url":"https://daily.dev/alsiam","image":"https://media.daily.dev/image/upload/s--O0TOmw4y--/f_auto/v1715772965/public/noProfile"}},{"@type":"Comment","text":"They’re stored on different heap memory addresses.","datePublished":"2023-09-01T03:49:42.997Z","url":"https://daily.dev/posts/t431RDugc#c-hTIJ3JB9k","author":{"@type":"Person","name":"xuan mai","url":"https://daily.dev/xuanmai","image":"https://lh3.googleusercontent.com/a/AAcHTtcUz-v-4SrYmDLjfG-rRJhbBeOM7nd6qB7YtkE_MM8ScQ=s96-c"}},{"@type":"Comment","text":"Nice","datePublished":"2023-07-26T16:36:39.917Z","url":"https://daily.dev/posts/t431RDugc#c-i6OLAUbkA","author":{"@type":"Person","name":"Mike Brown","url":"https://daily.dev/mikeb275","image":"https://avatars.githubusercontent.com/u/95425903?v=4"}}]}
```

