4 ms·
The fun thing about JavaScript's type coercion and concatenation is that you can use it to create fun brain benders like this: +[[+!+[[]]]+[![]][+[[]+[]]]++]
by Hupo 14y ago
The fun thing about JavaScript's type coercion and concatenation is that you can use it to create fun brain benders like this:
+[[+!+[[]]]+[![]][+[[]+[]]]++] === 10
This evaluates to true. Cookie for anyone who can explain why!
- spoiler 14y agoI gues it could be because + infront of an empty array returns 0. So, when you do !+[] you get 1. What you pasted it a bit of a labyrinth, but if someone bothered to keep track of it, they could definitely find ten 1s in there. It's not why, it's a how. I hope someone figures out the rest and gets a cookie! :D