Why not to use == and always use ===?

Below reasons are responsible for not using ==.

  1. Execution Time
  2. Confusion while debugging.

Let’s start with first point

  1. Execution time:- Where ever it is found by js engine that “==” is used, then javascript will first type cast the second operand value in the data of first operand after which,it compares the both the operand values. While in “===” , it directly compares the both the value and returns the boolean value.
  • Confusion while debugging:- Whenever while debugging the code, if let’s say first operand is of type integer and second operand is of string data type, then it may confuse the person and also it is not a good practice to use string to represent the number value.

Thank you please follow me

--

--

--

love ❤ coding, solving some industry problems technologies: JavaScript, C#, Angular, PLSQL, Docker Want to learn: Python, Go language, AI, ML and Cloud

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

https://joinhub.com/events/shard-on-kucoin-exchange/:xQycXygq?rc=Gennied-Cao-3115

Automatic enum values conversion in Elixir

React Redux: Adding to Arrays

Battle-Tested JavaScript Frameworks: Introduction to Frameworks and Libraries

How to Build “Redux” (and a Web App) Using Functional Programming Concepts in JavaScript: Parts 1…

The Famous Todo App

7 ES6 Spread Operator Tricks Every Developer Should Know

Project 1 : Simplifying Functions in Javascript

Identifying disappearing web elements

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vishal Pathak

Vishal Pathak

love ❤ coding, solving some industry problems technologies: JavaScript, C#, Angular, PLSQL, Docker Want to learn: Python, Go language, AI, ML and Cloud

More from Medium

Briefly The Importance Of Interfaces

How to Use Git with Unity

Day 10 of Game Dev: How to create a cooldown feature in Unity!

Creating a simple API using ASP.NET Core