Skip to content

Instantly share code, notes, and snippets.

@avelino
Created December 29, 2011 02:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avelino/1531375 to your computer and use it in GitHub Desktop.
Save avelino/1531375 to your computer and use it in GitHub Desktop.
++[[]][+[]]+[+[]]
> test = []
[]
> test = test + 1
"1"
> typeof test
"string"
------------------------------------
> lero = ++[[]][+[]]+[+[]]
"10"
> typeof lero
"string"
@herberthamaral
Copy link

"5" + 1 == "51"
"5" - 1 == 4

@herberthamaral
Copy link

function teste () { return teste }

teste()()()()()()()()()()()()()() //quase um fork bomb em JS :P

@suissa
Copy link

suissa commented Dec 29, 2011

AHUhahuahuhuahuahuhuahuaHAhua QUE MEDO!!!!

@davidsonfellipe
Copy link

e essa?

0.1 + 0.2 = 0.30000000000000004
0.1 + 0.21 = 0.31
0.2 + 0.1 = 0.30000000000000004

@herberthamaral
Copy link

Isso é devido à aritmética de ponto flutuante. Python tem isso também. Veja http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

@herberthamaral
Copy link

Em tempo: http://wtfjs.com/

@avelino
Copy link
Author

avelino commented Dec 29, 2011

Isso é horrivel,
",,," == new Array(4); // true

Onde uma string pode virar um array de 4?

@avelino
Copy link
Author

avelino commented Dec 29, 2011

Como pode isso:
function Dude(name){
this.name = name;
return {name: 'Doug'};
}

var bob = new Dude('Bob');
bob == Dude("test") // false

Troll face

@henvic
Copy link

henvic commented Dec 29, 2011

hahahahaha

@suissa
Copy link

suissa commented Dec 29, 2011

Coisa de maluco mesmo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment