Possible Duplicate:
Can you explain why ++[[]][+[]]+[+[]] = 10
I'm wondering something for few days...I know that unary plus in JavaScript first converts it's operand to Number. I'm applying + to an empty array and I get the following result:
+[] == 0
When I do this:
+[1] == 1
But:
+[1,2] == NaN
The last two things are almost clear but why the empty array is 0?! Is this connected with:
[] == false
Some times ECMAScript makes me wonder a lot...
alert([![]+[]][+[]][+[]]+[![]+[]][+[]][+!+[]]+[!+[]+[]][+![]][+![]]+[![]+[]][+[]][+!+[]]+[![]+[]][+[]][+!+[]+!+[]]+' '+(![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]);
Best regards!