YouTube Icon

What is the Difference Between =, ==, and === in JavaScript

What is the Difference Between =, ==, and === in JavaScript

What is = in JS? 

Equivalent to (=) is a task administrator, which sets the variable on the left of the = to the worth of the articulation that is to its right side. This administrator doles out lvalue to rvalue. 

For instance, Writing abc=100 is fine. In the event that we compose 100=100, 'abc' = 100 or 'abc' = 'abc', it will bring about a reference blunder. 

What is == in JS? 

Twofold equivalents (==) is an examination administrator, which changes the operands having a similar kind before correlation. 

Thus, when you contrast string and a number, JS changes any string over to a number. An unfilled string is consistently converts to nothing. A string with no numeric worth is converts to NaN (Not a Number), which returns bogus. 

What is === in JS? 

=== (Triple equivalents) is a severe fairness examination administrator in JS, which returns bogus for the qualities which are not of a comparative kind. This administrator performs type projecting for uniformity. On the off chance that we contrast 2 and "2" utilizing ===, it's anything but a bogus worth. 

Why use = in JS? 

Here are the significant employments of = in JS: 

= JS administrator relegates a worth to one side operand relies upon the worth of operand accessible on the right side. The principal operand ought to be a variable. 

The fundamental task administrator is =, that doles out the worth of one operand to another. That is, abc = bcd doles out the worth of bcd to abc. 

Why use == in JS? 

Here are the significant employments of == in JS: 

The == administrator is a correspondence administrator. It checks if its two operands are something very similar by changing articulation from one information type to other people. You can utilize == administrator to think about the personality of two operands despite the fact that, they are not of a comparable sort. 

How === Works Exactly? 

  • Severe equity === watches that two qualities are something very similar or not. 
  • Worth are not certainly changed over to some other worth before correlation. 
  • Assuming the variable qualities are of various kinds, the qualities are considered as inconsistent. 
  • On the off chance that the variable are of a similar sort, are not numeric, and have a similar worth, they are considered as equivalent. 
  • In conclusion, If both variable qualities are numbers, they are viewed as equivalent if both are not NaN (Not a Number) and are a similar worth. 

Illustration of = 

In the underneath program, there are two factors "abc" and "bcd". We are adding and printing their qualities utilizing a third factor, "cde". The amount of the worth of variable "abc" and "bcd" is 7. Thusly, the yield is 7.

<!DOCTYPE html>
<h4>JS Operators</h4>
 <div>abc = 2, bcd = 5, calculate cde = abc + bcd, and display cde:</diiv> 
<div id="inputContent"></div>
<script type="text/javascript">
var abc = 2;
var bcd = 5;
var cde= abc + bcd;
document.getElementById("inputContent").innerHTML = cde;

Illustration of ==

In the below program, we have declared one variable "abc" having value 100. Lastly, the statement abc == 200 returns false as the value of a is 100.

<!DOCTYPE html>
<div id="inputContent"></div>
<script type="text/javascript">
  var abc = 100;
  document.getElementById("inputContent").innerHTML = (abc == 200);


Illustration of ===

In the below program, the value of variable xyz is 100. It is compared to 100 written in double-quotes, which is considered as a string, and therefore, the values are not strictly the same. The output of the program is false.

<!DOCTYPE html>
<div id="demoContent"></div>
<script type="text/javascript">
  let xyz = 100;
  document.getElementById("demoContent").innerHTML = (xyz === "100");


  • = is utilized for doling out values to a variable, == is utilized for looking at two factors, however it overlooks the datatype of variable while === is utilized for contrasting two factors, yet this administrator likewise checks datatype and looks at two qualities.
  • = is called as task administrator, == is called as correlation administrator though It is likewise called as examination administrator.
  • = doesn't return valid or bogus, == Return genuine provided that the two operands are equivalent while === returns genuine provided that the two qualities and information types are no different for the two factors.

Author Biography.


CrowdforThink is the leading Indian media platform, known for its end-to-end coverage of the Indian startups through news, reports, technology and inspiring stories of startup founders, entrepreneurs, investors, influencers and analysis of the startup eco-system, mobile app developers and more dedicated to promote the startup ecosystem.

Join Our Newsletter.

Subscribe to CrowdforThink newsletter to get daily update directly deliver into your inbox.

CrowdforGeeks is where lifelong learners come to learn the skills they need, to land the jobs they want, to build the lives they deserve.


CrowdforThink is a leading Indian media and information platform, known for its end-to-end coverage of the Indian startup ecosystem.


Our mission is "Har Koi Dekhe Video, Har Ghar Dekhe Video, Ghar Ghar Dekhe Video" so we Provide videos related to Tutorials, Travel, Technology, Wedding, Cooking, Dance, Festivals, Celebration.

Apna Video Wala

News & Blogs


An In-Depth Guide On Choosing Best Frontend Fra...

Since the outbreak of COVID-19, business operations have been moved online to make ends meet....


JavaScript Mobile Frameworks worth considering ...

When it comes to startups entering the business arena, they have very tough competition. This is ...


How to Generate a PDF with JavaScript

An extremely regular use case today is that of enabling your clients to download information from...

Top Authors

Lamia Rochdi is the Marketing Manager at Bell Flavors & Fragrances EMEA. A successful family-...

Lamia Rochdi

I’m Mertin Wilson a technician in a camera company and certified expert of different P...

Mertin Wilson

Zakariya has recently joined the PakWheels team as a Content Marketing Executive, shortly after g...

Zakariya Usman

Pankaj Singh is a Senior Digital Marketing Consultant with more than 2 years of experience in SEO...

Pankaj Singh

Our Client Says

WhatsApp Chat with Our Support Team