3 ms·
Wait, is it using the image data as code to evaluate? My mind is too blown to appreciate this. EDIT: Oh, okay. It's not a valid PNG. That would have been all s
by StavrosK 14y ago
Wait, is it using the image data as code to evaluate? My mind is too blown to appreciate this.
EDIT: Oh, okay. It's not a valid PNG. That would have been all sorts of incredible. Still great, though.
- tlack 14y agoI wrote up a little explanation of how it works here https://gist.github.com/3039247 https://gist.github.com/3039247
- StavrosK 14y agoVery interesting, thanks! By the way, the for loop seems to be irrelevant to the invocation, (1,eval) just returns eval. (1,console.log)("hi") looks like it should work, except it raises an error. (1,2)+3 returns 5, however, and (1,console.log) returns the log function.
- skrebbel 14y agoit's a performance thing. i forgot the details, but if you change the `(1,eval)` to `eval`, it's all much slower. something with the scope of the code that's being eval'ed, if i recall correctly.
- tlack 14y ago(1,eval)('2*2') evaluates in the global context, so it may be slower I would think. Here's a really long and insanely detailed post about this odd feature: http://perfectionkills.com/global-eval-what-are-the-options/ http://perfectionkills.com/global-eval-what-are-the-options/