Javascript has always been fascinating to me in so many ways, because it packs in so many things for a language that has been developed in 2 weeks (there were improvements after that). Look at this
JavaScript
var truthy = true;
if(truthy === !+[]){
console.log("It's Truthy");
}
Put this in the console and it prints the value. It’s ’cause
!+[] === true
javascript interprets the combination of these special characters into actual values. Similary
!!+[] === false
And also you can get numbers like this
+[] === 0 +!+[] === 1 !+[]+!+[] === 2 ....
We can create all the numbers by adding !+[] like that. Using this, if you want your fellow programmer to go mad you can do something like this
JavaScript
var l = +!+[];
for (var i = +[]; i <= !+[] + !+[]; i++) {
l = l + (+!+[]);
console.log(l);
}
with these special character combinations, a complete program can be written in javascript.
Further reading:
http://patriciopalladino.com/blog/2012/08/09/non-alphanumeric-javascript.html