Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
103
rated 0 times [  107] [ 4]  / answers: 1 / hits: 17712  / 10 Years ago, wed, november 5, 2014, 12:00:00

I have seen many places where angular js uses triple equals sign === to compare two elements why not 2 equalsenter== . I am just wondering is there any specific reason for that ?


More From » angularjs

 Answers
25

The === operator checks value and type while the == operator only checks value, simple example



1 == 1 -> true
1 === 1 -> false (types are not equal)


Sometimes you want to use this strict comparison, especially when checking a boolean value.



1 == true -> true
1 === true -> false (types are not equal)

[#68909] Monday, November 3, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
corie

Total Points: 371
Total Questions: 110
Total Answers: 113

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
corie questions
Mon, Feb 22, 21, 00:00, 3 Years ago
Tue, Sep 1, 20, 00:00, 4 Years ago
Thu, Nov 14, 19, 00:00, 5 Years ago
Sun, Jun 9, 19, 00:00, 5 Years ago
;