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

  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



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