Re:JSFuck – esoteric JavaScript
by thomasfoster96 on Sunday May 03, 2015 @04:38AM
(#9480504)
Most of it is warts and is completely useless. Sometimes things like knowing that an array is an abject are pretty important if you're writing production code.
The bit at the end (integer and float casting) is almost essential knowledge now for anyone writing JavaScript code that does anything mildly intensive.
The problem is the strong-typing/weak-typing distinction, not the static-typing/dynamic-typing distinction. For example, Python is about as strongly typed as C++ yet they're on opposite sides wrt. how dynamic their types are.
Using +x to convert things to numbers and x|0 to convert things to 32-bit integers are useful and common operations.
Re:JSFuck – esoteric JavaScript
by Manishearth on Sunday May 03, 2015 @07:25AM
(#9480898)
> Does knowing any of this make you a better programmer? I'd say no.
Yes it does, it makes sure you never do this ;P
Adding arrays sounds like something I'd totally try in JS, had I not known that it causes magic unicorn sparkles to happen)
Re:JSFuck – esoteric JavaScript
by xanderjanz on Sunday May 03, 2015 @04:18AM
(#9480472)
Useful for obfuscating executable JS for security reasons.
Re:JSFuck – esoteric JavaScript
by BinaryIdiot on Sunday May 03, 2015 @11:44AM
(#9481709)
Security through obscurity is not security. This would be easy to translate back into the original code anyway. This is also not efficient from a file size perspective which is cancer on the web.
Re:JSFuck – esoteric JavaScript
by thomasfoster96 on Sunday May 03, 2015 @04:40AM
(#9480513)
It'd have to be something that really had to be hidden, because most of these edge cases are very very slow to run.
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.