Can anyone explain clearly about comparison operator '==='? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone explain clearly about comparison operator '==='?

11th Mar 2017, 8:58 AM
Khuntheng Puthirithea
Khuntheng Puthirithea - avatar
3 Answers
+ 4
with a simple == you are testing values if they are equal but if you add one more = you check if the variable type is equal. for this reason 10=="10" is true but 10==="10" is wrong cause you are comparing an integer with a string.
11th Mar 2017, 9:15 AM
Geoffrey L
Geoffrey L - avatar
0
That become usefull to compare types when you want to build a strict program, not wide open and ready to accept any type of input in a form for example.
11th Mar 2017, 9:18 AM
Geoffrey L
Geoffrey L - avatar
0
Hi there. === means that the values you are comparing are identical. Example: 3===4 is false. Because 4 is not 3. 3===3 is true. Because 3 is 3. Do I answer your question? Please let me know. Good luck!
20th Mar 2017, 9:06 AM
Emma
Emma - avatar