Using jsish
Not logged in


There are a number of different ways to invoke jsish:


Interactive mode is the easiest way to try out Jsi, eg:
# var a = [1,2,3];
# for (var i in a) { puts(a[i]); }

Note, if running the precompiled (static) Linux executable, command-line editing is available via rlwrap:

rlwrap ./jsish

Script Files

Script-files can be executed like so:

jsish prog.js arg1 arg2

Or, to make a script directly executable under unix, the first line of a Jsi script starts with #!:

cat > prargs <<EOF
#!/usr/bin/env jsish
for (var i in console.args) {

chmod a+rx prargs

./prargs able baker charlie


Although less common Javascript can be evaluated inline with -e, eg:
jsish -e 'var i = 0; while (i++<10) puts(i);'


Various commands in Jsi take an options object to parameterize behaviour. For example:

var db = new Sqlite('/tmp/testsql.db',{maxStmts:1000, readonly:true});
db.conf( {debug:1} );
puts( db.conf() );

In the case of object commands, a conf() method is provided for accessing options, post creation.

For example, we can use Interp.conf() for accessing interpreter options:

Interp.conf(); // Dump all options
Interp.conf('strict'); // Get one option
Interp.conf({strict:false, maxDepth:99}); // Set one or more options.

Note that options marked as initOnly may only be set at interpreter creation time, and readOnly not at all.

Internally, option parsing is implemented via C-Options.


There are several levels of introspection built-in to Jsi. The conf() method above is just one example.

Another is Info.cmds() which allows inspection of available commands:

# Info.cmds()
[  "Array", "Boolean", "File", "FileIO", "Function", "Interp", "Info", "JSON", "Math", "Number",
   "Object", "RegExp", "Signal", "Sqlite", "String", "Sys", "Websocket", "Zvfs", "assert", "clearInterval",
   "console", "decodeURI", "encodeURI", "exit", "source",
   "isFinite", "isNaN", "load", "parseFloat", "parseInt", "puts", "quote",
   "setInterval", "setTimeout", "format" ]

# info.cmds('Array.*')
[ "Array.concat", "Array.filter", "Array.forEach", "Array.indexOf", "Array.isArray", "Array.join",
 "Array.lastIndexOf", "Array.map", "Array.pop", "Array.push", "Array.reverse", "Array.shift", 
 "Array.sizeOf", "Array.slice", "Array.some", "Array.sort", "Array.splice", "Array.unshift" ]

Yet another is apparent upon invalid method invocation, eg:

  # info.xxx()
  error: 'info', sub-commands are: cmds data error event executable funcs interp
  keywords named platform revisions script vars version.    (at or near "xxx")

Example Applications

Jsi is distributed with several demonstration web applications:

These are both standalone applications.



If you use the convenient Geany editor with Jsi, you can enable file completion in Geany:

Geany can also be setup to navigate through Jsi's gcc style scripting errors:

Now hit F8 to run the script. Upon errors, you should be able to navigate to the highlighted lines, and see warnings in the bottom pane.

Alternatively, you can just create a Makefile that runs jsish.

Note: a function with a return type will likely not show up in the symbols list in Geany.


Here is how to setup vim:
:set makeprg=jsish\ %

Then to run scripts just use: