To check if a variable(a) has the value null, use the following code: if (a === null) // Best way to do it! if (a == null) // This does return true if a is null but it returns true also if a is undefined… so avoid it To check if a variable(a) has the […]
Tag: ==
JavaScript has two sets of equality operators: === and ==. They mostly work exactly the same ie, if the operands are of the same type and have the same value, then === produces true & so does ==. But if the operands are of different types, then === produces false & == says true. The […]