The NOT operator is the simplest of these as it simply inverts the boolean passed to it returning true if it was passed false and false if it was passed true. AND only returns true if both values passed to it are true and returns false if either or both are false. OR returns true if either of both are true and only returns false if both are false.
This applies the NOT operator to the value returned from the something() function twice. The effect is that regardless of what the function returns it will be converted to either true or false. Basically this is a shortcut for converting anything into a boolean. The first time the operator is applied it converts the result to a boolean but also reverses the value. The second NOT reverses the value again to give the boolean equivalent of the original value.
x = +x || 0
Using a unary + on a value converts it to a number or to NaN if it isn't a number. All of the values that this can produce except for 0 and NaN evaluate as true and so those values will be retained in x. When the +x evaluates as 0 or NaN then the right value is evaluated and while the operation still evaluates as false, the right value gets used in the assignment regardless as there are no more operators to be evaluated. This ensures that x is definitely a number as everything else gets converted to 0.
false && something() || somethingelse()
Because the left value of this AND operation is false the rest of the statement never gets run at all. The something() and somethingelse() functions are not even called.
true || something() && somethingelse()
true && something() || somethingelse()
In this example the something() function will be run. If it returns true then the somethingelse() function will not run but if it returns false then the somethingelse() function needs to run in order to determine the final result.
Should you need to have the functions all run regardless of the results returned by the prior code then you would need to run all of the functions and assign the values returned to variables and then use those variables in place of the functions in the boolean comparison.
This article written by Stephen Chapman, Felgall Pty Ltd.