Hey there! any question in your mind? Ask It Now!.

Popular Categories





Exact differences Between These operators (== ) and (===)

+1 vote
53 views
asked in Programming by meetmagical (350 points)
Hello guys i am new in java and want to know Exact differences Between These operators (== ) and (===)

2 Answers

+1 vote
answered by duke Expert (5,813 points)
selected by meetmagical
 
Best answer

I would like to tell you about operators 

in java script === is same as == fast but If we talk about types are not the same, === will be faster because it is not trying  to do the conversion now.

             Identity (===. !==)

These operators behave identically to the equality operators except no type conversion is done, and the types must be the same to be considered equal.

These are some other type of operators 

When comparing strings, JavaScript uses the Unicode character value of the string expression.

The following describes how the different groups of operators behave depending on the types and values of expression1 and expression2:

Relational (<, >, <=, >=)

  • Attempt to convert both expression1 and expression2 into numbers.

  • If both expressions are strings, do a lexicographical string comparison.

  • If either expression is NaN, return false.

  • Negative zero equals Positive zero.

  • Negative Infinity is less than everything including itself.

  • Positive Infinity is greater than everything including itself.

Equality (==, !=)

  • If the types of the two expressions are different, attempt to convert them to string, number, or Boolean.

  • NaN is not equal to anything including itself.

  • Negative zero equals positive zero.

  • null equals both null and undefined.

  • Values are considered equal if they are identical strings, numerically equivalent numbers, the same object, identical Boolean values, or (if different types) they can be coerced into one of these situations.

  • Every other comparison is considered unequal

Know More about operators here

commented by meetmagical (350 points)
Thanks for your explanation ,I got the point.
0 votes
answered by amit_pammu Expert (5,030 points)

(==) and (===),
both arte use for the comparision..!!! but the difference between them..is   

===,  'strict comparison' means is the same type and equal

== simply means equal ,it does not compare the type !!

Related Questions

+7 votes
1 answer 503 views
0 votes
5 answers 514 views
0 votes
1 answer 65 views
+5 votes
2 answers 61 views
+1 vote
1 answer 240 views
+15 votes
2 answers 6,907 views
+7 votes
8 answers 7,324 views

Not a Member yet?

Ask to Folks Login

My Account
644 Folks are online
55 members and 589 guest online
Your feedback is highly appreciated