5

MacOS ships with a JavaScript shell jsc in the JavaScriptCore framework. The easy way to run it from Terminal is to link it into a standard directory:

ln -s /System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc /usr/local/bin/jsc

What built-in JavaScript functions does jsc support?

The manual page documents some JavaScript functions like readline() and run(filename). But it's out of date — it's missing the command line options printed out by jsc --help.

I found the the source code to jsc. It sets up more JavaScript functions. Most of them look like testing and benchmarking hooks, but there some useful-looking functions like read and print. Are they documented anywhere?

1 Answers1

1

There isn't much to the documentation. It's merely a framework allowing you to run JavaScript from Swift, Objective-C and C based apps.

From Apple Developer:

The JavaScriptCore Framework provides the ability to evaluate JavaScript programs from within Swift, Objective-C, and C-based apps. You can use also use JavaScriptCore to insert custom objects to the JavaScript environment.

The functions that are supported are referenced here

Allan
  • 101,432