Reputation:
if (description !== undefined)
i found this in nerd dinner tutorial.
Upvotes: 2
Views: 189
Reputation: 1891
This is the strict not equal operator and only returns a value of true if both the operands are not equal and/or not of the same type. The following examples return a Boolean true:
a !== b
a !== "2"
4 !== '4'
For more operator information refer here Dev Guru Forum
Upvotes: 2
Reputation: 3108
This is the strict not equal operator and only returns a value of true if both the operands are not equal and/or not of the same type.
Upvotes: 1
Reputation: 382676
It is identity operator that not only checks for value but also type.
Example:
if (4 === 4) // both type and value are same
{
// true
}
but
if (4 == "4") // value is same but type is different but == used
{
// true
}
and
if (4 === "4") // value is same but type is different but === used
{
// false
}
You should use ===
or !==
once you are sure about both value and type.
Upvotes: 4