can anyone elaborate the difference between != and !== with examples.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can anyone elaborate the difference between != and !== with examples..

20th Aug 2016, 6:17 PM
Tanu Dhiman
Tanu Dhiman - avatar
3 Answers
+ 2
!= means not equal, and !== means not equal or not at the same format. example: 2 != "2" this will return false because its same 2 !== "2" this is true because its not at the same format, the first is int and the second is string
21st Aug 2016, 12:45 AM
Fernando Carlo
Fernando Carlo - avatar
+ 1
! = will only check the value, and if value does not match gives you the result as true. Var data1 = 5; Var data2 = 'u' ; If(data1! =data2) { } this will be true, but when you do If(data1! ==data2) { } this will give you compilation error as the data1 is interger but data2 is string.
5th Sep 2016, 8:21 AM
Ritweek
Ritweek - avatar
0
the first one means " not equal " the second one means " not identical "
21st Aug 2016, 1:47 AM
Khalid
Khalid - avatar