+ 1
So if === is the best choice to practice, is !== also a better choice than != to avoid future problems in the script?
6 Antworten
0
!== When you want to check value and type.
0
nothing is good or bad.
use as per your convenience and requirement.
0
No it's not like that.It differs where and how you want to use it.When you know that variables are of same type use!= and if you don't know the types use !==
0
think of the first character (either = or !) as saying is or is not
== "is" equal to
!= "is not" equal to
=== "is" exactly equal to
!== "is not" exactly equal to
I'm not sure if that's the rationale but it helps me
0
heres an example
var JavaScript = true;
if(JavaScript == false)
{
alert("Start!");
}
if(JavaScript != false) // or == true
{
alert("cool!");
}
- 3
====================== lol no jkm