2
if (description !== undefined)

i found this in nerd dinner tutorial.

1

3 Answers 3

4

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.