0

For what purpose if(!a) statement used?

9th Sep 2018, 6:03 AM
Shreyas Bobde
Shreyas Bobde - avatar
4 Réponses
+ 3
if (a == false)
9th Sep 2018, 6:07 AM
Микола Федосєєв
Микола Федосєєв - avatar
+ 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.
9th Sep 2018, 8:25 AM
Caleb Daix
Caleb Daix - avatar
0
it means your condition is not true.. '!' this symbol is use for making any boolean to false.
9th Sep 2018, 6:17 AM
Mustufa Ansari
Mustufa Ansari - avatar