Today met "!! Null ", Baidu did not find a direct explanation, the book in the" Advanced design of JavaScript "P44 found the corresponding explanation:
Using two logical non-operators, in effect, simulates the behavior of a Boolean () transformation function. Where the first logical non-operator returns a Boolean value based on whatever operand, and the second logical non-operation evaluates the Boolean value, the Boolean value that the value really corresponds to is obtained. Of course the end result is the same as using the Boolean () function for this value.
So actually personally think,!! The notation is a simple notation for Boolean ().
You can run the following example to see more visually:
Alert (!! " Blue "); Alert (Boolean (" Blue ")); Alert (!! NULL); alert (Boolean (null));
If you have any mistake, please indicate ~
JS logic is not used at the same time two times!! Null