Skip to content
Advertisement

Can’t rectify a condition in the right way when there are multiple nots involved

I’m trying to combine multiple not conditions in a single line but I can’t make it. This is how the conditional statements should be built upon:

when stat has a value and both the value of alternative and successor are nothing then only the script should print true.

When I try the following, I get true as the result.

JavaScript

However, When I execute the following, I also get true as the result

JavaScript

How can I rectify the condition above to serve the purpose?

Advertisement

Answer

both the value of alternative and successor are nothing

This literally translates to

JavaScript

By De Morgan’s laws it is equivalent to

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement