![]() |
In JavaScript, equality operators like double equals (==) and triple equals (===) are used to compare two values. But both operators do different jobs. Double equals (==) will try to convert the values to the same data type and then try to compare them. But triple equals (===) strictly compares the value and the datatype. Two Types
Example 1: Double Equality (==) In this example, we are trying to compare a string and a number.
Javascript
Output
true The output is true, because they have different data type but same value. Example 2: Triple Equality (===) In this example, we are trying to compare a string and a number.
Javascript
Output: false
|
Reffered: https://www.geeksforgeeks.org
Geeks Premier League |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 16 |