Skip to content

Instantly share code, notes, and snippets.

@avelino
Created Dec 29, 2011
Embed
What would you like to do?
++[[]][+[]]+[+[]]
> test = []
[]
> test = test + 1
"1"
> typeof test
"string"
------------------------------------
> lero = ++[[]][+[]]+[+[]]
"10"
> typeof lero
"string"
@herberthamaral
Copy link

herberthamaral commented Dec 29, 2011

EcmaScript é bizarro :P

test = []
[]
test = test + 1
"1"
test
"1"
test = []
[]
test++
0
test
1
typeof(test)
"number"

@avelino
Copy link
Author

avelino commented Dec 29, 2011

O tipagem FDP

@herberthamaral
Copy link

herberthamaral commented Dec 29, 2011

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

@herberthamaral
Copy link

herberthamaral commented Dec 29, 2011

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

davidsonfellipe commented Dec 29, 2011

e essa?

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

@herberthamaral
Copy link

herberthamaral commented Dec 29, 2011

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

herberthamaral commented Dec 29, 2011

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