things that are difficult to do in code, processing multiple simultaneous signals is done visually, running lines between object, but when you do want to write code, you open a code window and write javascript, and can then run visual patch cables to your javascript code representing the inputs and outputs.
True story: Some years ago, a consulting assignment involved analyzing a bunch of data saved on a slow as molasses NAS using SAS's data format. The work was CPU intensive but IO throughput was the bottleneck. The analysis was close to being embarrassingly parallelizable[1] given an appropriate partitioning of the data.
The only thing installed on the remote system I was given access to via RDP was SAS whose macro facility tends to be cumbersome. Since the original CSV files were also stored on the same NAS, I asked if could have any programming language installed in my home directory (there was absolutely no way for me to upload anything, the system had no internet access other than to allow RDP, and I wasn't going to violate any rules.
The sysadmin head read BOFH for career development in the 90s, so, the answer was a solid no. I had to only use what was available on the system. The problem was simple: Each run took about two days: Start the thing at 7 am one day so you can hope to have the results before 4 pm two days later kind of thing. That's when I remembered `cscript`.
Using that, built a "thing" that orchestrated the copying of data in 100 GB chunks to `%TEMP%` which was still on the precious 256 GB SSD :-), launching multiple jobs etc. Task manager screenshots: https://www.nu42.com/2013/12/happiness-is-making-most-out-of...
In less than a week, jobs were running in four hours. sysadmin remained happily oblivious. Had to explain what I had done to the rest of the group.
There's also the "jsc.exe" JScript.Net compiler included in .NET framework installs. You can access .Net assemblies and APIs. It's handy to have it out-of-the-box on modern Windows machines.
Tangentially related: jsvu seems to be the easiest way to install most JS engines on most platforms. This can be useful comparing performance or compatibility across JS runtimes without firing up emulators.
Yeah, there isn't really any reason to use it over something like nodejs, especially since it doesn't look like the code is portable (e.g. print instead of console.log, etc.).
It's not like it's the only scripting language available either, OSX comes with ruby, python2, python3 and perl by default.
The big difference is that it comes preinstalled. If you had a whole company on MacBooks but not all of them had Node installed, and you wanted to distribute a script written in JavaScript, this could be handy
Fairly niche, but not useless
I could also imagine some sort of Electron-alternative using the builtin JS interpreter for system stuff alongside the builtin webview for the UI
> The big difference is that it comes preinstalled. If you had a whole company on MacBooks but not all of them had Node installed, and you wanted to distribute a script written in JavaScript, this could be handy
Except when Apple decides to remove it from the default setup.
They're all still in the current Monterey beta (21A5294g) but python2 says (paraphrasing) "this is only for compatibility; it might not be here in future"
Yeah. This is a cool factoid, but for this kind of thing I usually just hop over to whatever browser tab is open and hit F12. If it really needs to be in the terminal, I'd reach for Node, or Deno, or JQ if it's anything to do with manipulating or interrogating JSON.
Fun fact: until the most recent versions (0.64 and 0.65), React Native has used JSC as its JS runtime. You can now opt into Hermes (a mobile optimized JS runtime from FB open source) for both Android and iOS (although better supported on Android for now).
QuickJs is quite slow compared to JIT engines when you’ll have a long running workload. The major advantage of QuickJS is simplicity - its trivial to compile with Emscripten [for example](https://jake.tl/projects/quickjs-emscripten), but if performance is a concern then I’d stick to the JIT engines.
The most fun I've ever had programming was in max/msp
https://cycling74.com/
things that are difficult to do in code, processing multiple simultaneous signals is done visually, running lines between object, but when you do want to write code, you open a code window and write javascript, and can then run visual patch cables to your javascript code representing the inputs and outputs.