Great abuse of the implicit type conversion system. Amazing that a simple alert("Hello world!") expands to over 16KB.
JSFuck – esoteric JavaScript
11–20 of 39 posts
Re: JSFuck – esoteric JavaScript
#12Amazing! I wonder if it's difficult to "disassemble" the JSFuck code?
Re: JSFuck – esoteric JavaScript
#13I know this will most likely come as a surprise to most Javascript programmers but all code is represented using only two "characters" deep inside your little computers!
Re: JSFuck – esoteric JavaScript
#14Re: JSFuck – esoteric JavaScript
#15Re: JSFuck – esoteric JavaScript
#16One interesting question was about the "performance impact"? One reply was: "Vanilla I got 225k ops/sec. JSFuck, 4.5 ops/sec. So about 50000 times slower."
Re: JSFuck – esoteric JavaScript
#17Re: JSFuck – esoteric JavaScript
#18Re: JSFuck – esoteric JavaScript
#19For those wondering how you get numbers, strings and other primitives from a whole bunch of empty arrays and objects in JavaScript, here's what happens when you do arithmetic and other operations on arrays and objects: > [] + [] "" (An empty string) > {} + [] 0 (The number zero) > [] + {} "[object Object]" (.toString() called on a plain object). > ![] false (!{} is the same) > !![] true (not false) > +[] 0 (the numbe…
Should you be using any of this in production code? No
The next programmer even if he is a really good one might not know that particular esoteric trick.
I'm not trying to vote down or anything, but what is the point? Most of it look like language design warts to me. Most of them should have thrown exceptions and errored out.
Now I'm loving the idea of static typing a lot more.
Re: JSFuck – esoteric JavaScript
#20For those wondering how you get numbers, strings and other primitives from a whole bunch of empty arrays and objects in JavaScript, here's what happens when you do arithmetic and other operations on arrays and objects: > [] + [] "" (An empty string) > {} + [] 0 (The number zero) > [] + {} "[object Object]" (.toString() called on a plain object). > ![] false (!{} is the same) > !![] true (not false) > +[] 0 (the numbe…
Does knowing any of this make you a better programmer? I'd say no. Should you be using any of this in production code? No The next programmer even if he is a really good one might not know that particular esoteric trick. I'm not trying to vote down or anything, but what is the point? Most of it look like language design warts to me. Most of them should have thrown exceptions and errored out. Now I'm loving the idea o…