What does !+ (exclamation mark addition) mean in JavaScript?
Why is !+"000" true?
Why is !+"0010" false?
Tries:
!+"000" // true !+"00010" // false !+"0a0" // true !+"0,0" // true !+[0,0,0] // true !+[0,1,0] // true true+"000" // true000 I've tried to search:
- In JavaScript, why is "0" equal to false, but when tested by 'if' it is not false by itself?
- What does "!--" do in JavaScript?
- What is the !! (not not) operator in JavaScript?
Here I saw the code: JS - Check if string contain only 0
This information is hard to find on the Internet.
true + "000"doesn’t use the unary+, but the binary one. The specification explains in detail what it does.