DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Roshan Shambharkar
Roshan Shambharkar

Posted on

== Vs === confusion Solve...🌟

Before knowing the difference between "==" vs "===" in JavaScript lets know about what are the == and != operator.
== vs !=
so the double equals (==) operator use to check if two values are equals and not equals (!=) if the two values are not equal
and its return type is always boolean like true **or **false.

In == and != both operater do type conversion before comparing the elements For e.g : - 2 == '2' so in this == operate do type conversion implicitly like before comparing it will do implicitly type coercion like 2 == Number('2') and then it will show output as *true **so this is what happens when we compares using == operater before showing output it add string '2' value in number fucntion and convert into number 2 and the comparing's we get the output as a true which 2 == 2
**for E.g *

let xxx = 2;
let xxxx = '2';
console.log(xxx == xxxx);// true
Enter fullscreen mode Exit fullscreen mode

Now Check with === operater is also called as strictly equality operator thats means it will not do any type conversion internally

For E.g:

let x = 1;
let y = '1'
console.log(x===y)// output will false
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

In defense of the modern web

I expect I'll annoy everyone with this post: the anti-JavaScript crusaders, justly aghast at how much of the stuff we slather onto modern websites; the people arguing the web is a broken platform for interactive applications anyway and we should start over;

React users; the old guard with their artisanal JS and hand authored HTML; and Tom MacWright, someone I've admired from afar since I first became aware of his work on Mapbox many years ago. But I guess that's the price of having opinions.