3 ms·
Sounds a lot like NodeJS.
by amelius 5y ago
Sounds a lot like NodeJS.
- qsort 5y agoYeah, 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.
- brundolf 5y agoThe 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
- amelius 5y ago> 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.
- ithrow 5y agoMy understanding is that macOS doesn't ship those runtimes anymore.
- masswerk 5y agoOn a current MBA/M1, which came with Big Sur: % which perl /usr/bin/perl % which python2 /usr/bin/python2 % which python3 /usr/bin/python3 % which ruby /usr/bin/ruby
- zimpenfish 5y agoThey'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"
- tumultco 5y agoIt wasn't in the above list, but Apple did completely remove PHP in Monterey.
- cmgxyz 5y agoYeah. 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.
- Scarbutt 5y agoYou can use javascriptcore in iOS though.
- leshenka 5y agoI like that jsc has global readline() function whereas in Node it's uhhh not so simple to get an input