Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Difference Between =, == And === In JavaScript

var number = 100;  // Here number variable assigned using = 

if (number == 100)
  // Here Comparision between two values using ==.
  // This will not check datatype irrespective of datatype it will do comparision  
  console.log("Both are equal");

else  
  console.log("Both are not equal");

if(number === "100")  //Here Comparision between two values using ===.
  // This will check datatype if it is same then it will do comparision otherwise it will go to else part  
  console.log("Both are equal");

else  
  console.log("Both are not equal");

/*
Output will be :- 
	Both are equal
	Both are equal
*/
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Difference #Between #And #In #JavaScript
ADD COMMENT
Topic
Name
4+9 =