The snippet that has to be used to check if “a” is not equal to “null” is _________

The snippet that has to be used to check if “a” is not equal to “null” is _________
A. if(a!=null)
B. if (!a)
C. if(a!null)
D. if(a!==null)
 
Answer: d
Explanation: 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.
 

Tìm kiếm

Back
Top