JSFuck – esoteric JavaScript
jsfuck.com
JSFuck – esoteric JavaScript
1–10 of 39 posts
Re: JSFuck – esoteric JavaScript
#2 alert(1)
will produce 1227 chars while alert(1);
will produce 9535 chars. Interesting.Re: JSFuck – esoteric JavaScript
#3Amazing that a simple alert("Hello world!") expands to over 16KB.
Re: JSFuck – esoteric JavaScript
#4with eval checked, alert(1) will produce 1227 chars while alert(1); will produce 9535 chars. Interesting.
I'd imagine that if you were serious about this, you'd implement, say, e=String.fromCharCode (12k chars) and use that to dig yourself out of a lot of this expensive stuff if you need more than one hard-to-encode character.
Re: JSFuck – esoteric JavaScript
#5Great abuse of the implicit type conversion system. Amazing that a simple alert("Hello world!") expands to over 16KB.
Re: JSFuck – esoteric JavaScript
#6Re: JSFuck – esoteric JavaScript
#7Amazing! I wonder if it's difficult to "disassemble" the JSFuck code?
Re: JSFuck – esoteric JavaScript
#8Re: JSFuck – esoteric JavaScript
#9> [] + []
"" (An empty string)
> {} + []
0 (The number zero)
> [] + {}
"[object Object]" (.toString() called on a plain object).
> ![]
false (!{} is the same)
> !![]
true (not false)
> +[]
0 (the number zero)
> -[]
-0 (negative zero)
> +{}
NaN (Not a number, same goes for -{})
> "" + []
"" (empty string)
> "" - []
0 (number zero, not empty string)
And the one that gets more people than the previous list:
> typeof [] === typeof {}
true
Incidentally, some of these things can be useful. For example, +(x) will always evaluate to a double (unless it is preceded by a string), while (x|0) will always evaluate to a 32bit integer. asm.js abuses (to an extent) this to have more control over types, and most JavaScript engines would now store the result of (x|0) as an integer internally instead of a double.