2 noiembrie 2012

Why ++[[]][+[]]+[+[]] evaluates to “10″ in JavaScript

Yes, you got it right. What the heck am I writing about? Did my cat just walked on the keyboard? No.

It’s just a particular thing, a curiosity. Here it is on stackoverflow. It’s about this ++[[]][+[]]+[+[]] line. Nothing special about it, except it doesn’t generate any errors, it’s valid, and much more, it returns “10″ in JavaScript!

Article here. Check out the comment. It’s funny. Yeah, we see what you mean there…

Niciun comentariu:

Trimiteți un comentariu