Operators (==, <=, <,> =, ==) accept only 2 arguments.
When there are more arguments, it uses the mathematical order of calculations. So in fact your code behaves like:
min <= amount // true true <= max // this is illogical
It is also optimal , because when executing logical instructions and searching for something like:
if(false && (some computing))
It ignores (some computing) , because the result will always be false
This is very common in all languages. A test like this will not have a NullPointerException error, because the first argument is already invalid.
if(obj != null && obj.getValue() > 10) //C++,Java, etc. if(obj !== undefined && obj.val() > 10) // javascript if(obj.length != 0 && obj.val() > 10) //jQuery
source share