<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/HtOJCUIBY" -->

---
title: Why you shouldn't use Double Equals Operator in JavaScript
description:  JavaScript has both double equals '==' and triple equals ' ===' comparison operator. Triple equals almost always better than double equals. The '='' operator...
canonical: https://daily.dev/posts/why-you-shouldn-t-use-double-equals-operator-in-javascript-htojcuiby
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Why you shouldn't use Double Equals Operator in JavaScript | daily.dev
og:description:  JavaScript has both double equals '==' and triple equals ' ===' comparison operator. Triple equals almost always better than double equals. The '='' operator...
og:url: https://daily.dev/posts/why-you-shouldn-t-use-double-equals-operator-in-javascript-htojcuiby
og:image: https://api.daily.dev/og/posts/HtOJCUIBY.png
og:image:alt: Why you shouldn't use Double Equals Operator 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 you shouldn't use Double Equals Operator in JavaScript

**[Hashnode](https://daily.dev/sources/hashnode)** · 3 min read · 19 upvotes · 1 comments

## Summary

JavaScript has both double equals '==' and triple equals ' ===' comparison operator. Triple equals almost always better than double equals. The '='' operator takes only value into consideration, not the type. If we compare 1 with '1' using ===, then it will return a false value.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.hrithwik.me/lose-equality-and-strict-equality-in-javascript>

---

[View this post on daily.dev](https://daily.dev/posts/why-you-shouldn-t-use-double-equals-operator-in-javascript-htojcuiby)

```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 you shouldn't use Double Equals Operator in JavaScript","url":"https://daily.dev/posts/why-you-shouldn-t-use-double-equals-operator-in-javascript-htojcuiby","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/why-you-shouldn-t-use-double-equals-operator-in-javascript-htojcuiby"},"datePublished":"2020-09-02T09:16:10.104Z","dateModified":"2021-10-07T14:17:10.317Z","description":" JavaScript has both double equals '==' and triple equals ' ===' comparison operator. Triple equals almost always better than double equals. The '='' operator...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/68222bd210f0824e7f8e5524309211d5","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/68222bd210f0824e7f8e5524309211d5","isAccessibleForFree":true,"articleSection":"Hashnode","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":"Organization","name":"Hashnode","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/4a287b2e7cb5499bae863f8e7137cdb4","url":"https://daily.dev/sources/hashnode"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/why-you-shouldn-t-use-double-equals-operator-in-javascript-htojcuiby","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":19},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hashnode","item":"https://daily.dev/sources/hashnode"},{"@type":"ListItem","position":3,"name":"Why you shouldn't use Double Equals Operator in JavaScript"}]}
```

