A
Q. The snippet that has to be used to check if “a” is not equal to “null” is _________
- Correct Answer - Option(A)
- Views: 29
- Filed under category JavaScript
- Hashtags:
A
In JavaScript, we use !== (strict inequality operator) to check both:
Example: Checking if a is not null
var a = "Hello"; // Example value
if (a !== null) {
console.log("a is not null");
} else {
console.log("a is null");
}
Output:
a is not null
If a = null, then the condition fails.
Why Not Other Options?
Final Answer:
✅ (A) if(a !== null) (Best practice for checking null).
You must be Logged in to update hint/solution
Be the first to start discuss.
Discusssion
Login to discuss.