Home » JavaScript » JavaScript Variables » Question
  1. The snippet that has to be used to check if “a” is not equal to “null” is _________
    1. if(a!==null)
    2. if(a!null)
    3. if (!a)
    4. if(a!=null)
    5. None of these
Correct Option: A

A strict comparison (e.g., ===) is only true if the operands are of the same type and the contents match. The more commonly-used abstract comparison (e.g. ==) converts the operands to the same type before making the comparison. The not-equal operator !== compares 0 to null and evaluates to either true or false.



Your comments will be displayed only after manual approval.