Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Logical NOT in JavaScript
//JavaScript-C24.2.0 (SpiderMonkey) // The '!' (Logical NOT) operator returns true if the value given is false // Let's check all the instances, when this applies // Read more: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators const emptyVariableIsUntrue; var untrueTable = [emptyVariableIsUntrue, NaN, undefined, null, false, 0, '', "", [], {}]; untrueTable.forEach(instance => { if (!instance) print(instance + " is false"); else print(instance + " is true"); }); // Empty object passes as true, in any other case false // Can we find more instances?
run
|
edit
|
history
|
help
1
Please
log in
to post a comment.
Dum
random2
Time Waister
Alternating Sign Fibonacci
random3
binary
JS exam part 2 - Find the property
FÜU 23.08
F
Functions
Please log in to post a comment.