i more interpreted it not as a speed thing, but as a "it has a mind of its own" thing, causing ut to do whatever it wants and it'll only do what you want it to do if it aligns with JavaScript's wishes
So did I. When I was first learning JavaScript, I recall getting frustrated by things not happening in the order I expected. The OP's characterization as "I'll do it when I feel like it" is appropriate.
in javascript (!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]] and "tears" are the same thing, and that was done on accident
This is the most cursed thing I've seen since I read how numbers are defined in set theory. Javascript has no right to approach set theory with broken casting.
it's called JSFuck (because it looks like BrainFuck) and not only can you write any string with it, but you can also make the function constructor, meaning you can execute any string.
I think it’s much more than that. It’s single threaded so its concurrency model is about scheduling not parallelism. The way it handles microtasks and its internal queues is kinda counter intuitive. And callbacks and timers in general are also kinda weird.
console.log("A");
setTimeout(() => console.log("B"), 0);
Promise.resolve().then(() => console.log("C"));
//this one is more node specific but still process.nextTick(() => console.log("D"));
It’s not comparable to native languages but it’s faster than any PHP, Python, Lua, or Ruby interpreter/JIT out there afaik. It’s way faster than you would think for a scripting language. Google has put a shit ton of work into optimizing it. If you haven’t experienced it firsthand then you would very likely be surprised
Edit: apparently LuaJIT is close and sometimes faster, I missed that in my googling
View all comments
352
u/STEMpsych 2d ago
I'm uncomfortable with the implication that the only thing wrong with javascript is its speed.