Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Difference between “ == “ and “ === “ operators

Both are comparison operators. The difference between both the operators is that “==” is used to compare values whereas, “ === “ is used to compare both values and types.

Example:

var x = 2;
var y = "2";
(x == y)  // Returns true since the value of both x and y is the same
(x === y) // Returns false since the typeof x is "number" and typeof y is "string"
Comment

Difference between “ == “ and “ === “ operators

Both are comparison operators. The difference between both the operators is that “==” is used to compare values whereas, “ === “ is used to compare both values and types.

Example:

var x = 2;
var y = "2";
(x == y)  // Returns true since the value of both x and y is the same
(x === y) // Returns false since the typeof x is "number" and typeof y is "string"
Comment

Difference between “ == “ and “ === “ operators.

/*
== in JavaScript is used for comparing two variables.
=== is used for comparing two variables, 
but this operator also checks datatype and compares two values
*/

0 == false   // true
0 === false  // false, because they are of a different type
1 == "1"     // true, automatic type conversion for value only
1 === "1"    // false, because they are of a different type
null == undefined // true
null === undefined // false
'0' == false // true
'0' === false // false
Comment

What is the difference between == and === operators

0 == false   // true
0 === false  // false
1 == "1"     // true
1 === "1"    // false
null == undefined // true
null === undefined // false
'0' == false // true
'0' === false // false
[]==[] or []===[] //false, refer different objects in memory
{}=={} or {}==={} //false, refer different objects in memory
Comment

Difference between “ == “ and “ === “ operators

Both are comparison operators. The difference between both the operators is that “==” is used to compare values whereas, “ === “ is used to compare both values and types.

Example:

var x = 2;
var y = "2";
(x == y)  // Returns true since the value of both x and y is the same
(x === y) // Returns false since the typeof x is "number" and typeof y is "string"
Comment

Difference between “ == “ and “ === “ operators

Both are comparison operators. The difference between both the operators is that “==” is used to compare values whereas, “ === “ is used to compare both values and types.

Example:

var x = 2;
var y = "2";
(x == y)  // Returns true since the value of both x and y is the same
(x === y) // Returns false since the typeof x is "number" and typeof y is "string"
Comment

Difference between “ == “ and “ === “ operators

Both are comparison operators. The difference between both the operators is that “==” is used to compare values whereas, “ === “ is used to compare both values and types.

Example:

var x = 2;
var y = "2";
(x == y)  // Returns true since the value of both x and y is the same
(x === y) // Returns false since the typeof x is "number" and typeof y is "string"
Comment

Difference between “ == “ and “ === “ operators

Both are comparison operators. The difference between both the operators is that “==” is used to compare values whereas, “ === “ is used to compare both values and types.

Example:

var x = 2;
var y = "2";
(x == y)  // Returns true since the value of both x and y is the same
(x === y) // Returns false since the typeof x is "number" and typeof y is "string"
Comment

PREVIOUS NEXT
Code Example
Javascript :: FTP download local file 
Javascript :: add webpack to react project 
Javascript :: button function jsx 
Javascript :: json parameter name javascript 
Javascript :: jquery change label content 
Javascript :: nested function 
Javascript :: vuetify use selected value 
Javascript :: how to check if an element is in array javascript 
Javascript :: how to make a 3*3 grid using html,css and javascript 
Javascript :: js get elements in array from x to y 
Javascript :: node red json array 
Javascript :: inch to cm 
Javascript :: History push for redirecting to another page in react-router v6 
Javascript :: Find items from object 
Javascript :: loading screen fivem js 
Javascript :: javascript weakset 
Javascript :: utc clock 
Javascript :: Group item by date 
Javascript :: js create nested object from array 
Javascript :: inner function in javascript 
Javascript :: react native image picker 
Javascript :: enhanced object literals in es6 
Javascript :: react scroll animation 
Javascript :: npm font awesome angular 12 
Javascript :: js loop through array 
Javascript :: lazy loading by scroll vue 
Javascript :: ArduinoJson.h 
Javascript :: mongoose create text index to search for text 
Javascript :: push an item to array javascript 
Javascript :: Angular passing function as component input 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =