Why does ++[[]][+[]]+[+[]] return the string "10"?
stackoverflow.com
stackoverflow.com
Basically everything in that WAT talk should be an error. If your code is throwing type errors, then either it's shitty code or you're trusting non-validated input, in which case you should be able to catch the type error and return an error back to whoever sent you the data.
print(chr(sum(range(ord(min(str(not())))))))
> ඞ
people wouldn't have these weird questions if we had used good programming languages from the start, but marketing dollars changed this timeline forever and every new generation learns about wtf-js
Lisps in browsers of that time would suffer from the same idea, which is “let’s make relaxed/ambiguous rules for noob script kids and cool one-liners”. Which is a mistake that many people made back then (perl, php, sh). Anything that has a potential for growth must have strict typing and non-funny coercion from the beginning.
It’s this naive idea that ruined whole ecosystems.
Why would you want to cut off normal people from attempting to communicate to join a community that was linking humanity together for the first time? This strikes me as elitist. Proper programmers with years of experience shouldn’t be the only ones allowed in.
We have “use strict;” for “serious” devs.
Remember, Java applets were supposed to be how you build Rich Internet Applications.
I recommend reading the "prehistory" chapters of this book: https://dl.acm.org/doi/pdf/10.1145/3386327
Yes I know the obvious problem with that, it would probably require changing our fundamental understanding of how a web browser works, I suspect the webbrowser would need to be at it's core an application specific vm designed around untrusted input. that is strict limits on cpu time, gated device access, etc. then the dom generator, languages and rendering engine would be implemented in this asvm.
The secondary problem, is this would probably destroy one of the webs greatest assets, everything is in plain text. yes, I know, there are all sorts of hoops you can jump through to obsfucate the text, but that is the thing, the default is shipping the source around. to do otherwise takes effort. A asvm based system would default to shipping compiled binaries around, which would suck.
But fundamentally changing the web is a boil the ocean type problem, never going to happen, we are stuck with our current web, much of it good, and much of it bad.
It's more realistic that we'd have ended up with VBScript dominating the browser landscape instead (Microsoft half-heartedly tried to acquire Netscape before the Sun deal and it's unlike Netscape would have lasted this long without the cooperation with Sun) and nobody wants to live in that timeline.
It was not in the original JS and added later on after someone asked/convinced Eich to do it (who quickly came to regret it, but by then "people were using it", and we're stuck with it today). He's talked about this a few times in interviews and talked about it on HN.
Has anyone seen a transpiler for regular JS into jsfuck?
It would be like maxify-obscurify
I expected `8`. `10` left me in disbelief before I found the accepted answer on the question.
I'm thinking it's not possible without being able to use '*'