0
For what purpose if(!a) statement used?
4 Réponses
+ 3
if (a == false)
+ 1
If you're talking about JS, then it will check if that variable is assigned a value. Example:
var a;
if (!a) {
document.write("Variable 'a' doesn't exist.");
} else {
document.write("Variable 'a' exists.");
};
// This code would say that 'a' doesn't exist because it was never assigned a string or an integer.
0
it means your condition is not true.. '!' this symbol is use for making any boolean to false.