JS(1)

NAME
js - Mozilla JavaScript Shell

SYNOPSIS
js [-w] [-W] [-S] [-x] [-C] [-c stackchunksize] [-S maxstacksize] [-b maxbranches] [-P] [-v version] [-e script] [-f scriptfile] [scriptfile] [scriptarg ...]

DESCRIPTION
The Mozilla JavaScript Shell js is a command line interface to the Mozilla JavaScript language engine ("SpiderMonkey"), as provided by the OSSP js distribution. The js program provides a test vehicle for easily evaluating JavaScript scripts, calling JavaScript functions, trying out debugger primitives, etc.

OPTIONS

  Compile-Time Options

-w  Disable the printing of warnings.

-W  Enable the printing of warnings.

-s  Enable strict language parsing during compile-time. This will print warnings on dubious JavaScript programming practices.

-x  Enable ECMAScript for XML (E4X) support during compile-time.

-C  Compile only. This compiles the script but does not execute it.

  Run-Time Options

-c stackchunksize
    Set the stack chunk size to stackchunksize bytes. The default is 8192.

-S maxstacksize
    Set a maximum stack size limit to maxstacksize bytes in order to restruct script resource consumption. The default is a stack of unlimited size.

-b maxbranches
    Set a maximum branch number limit to maxbranches in order to restrict script resource consumption. The default is an unlimited number of branches.

-P  In case the prototype object of the (potentially changed) global object is no longer connected to the global class, create a new global object (which is again connected to the global class) and set its prototype object to the old global object.

-v version
    override the numerical JavaScript version number, which the JavaScript version() function returns, with the value version. The argument version usually is one of the following integer values: 0 (default), 100 (JS 1.0), 110 (JS 1.1), 120 (JS 1.2), 130 (JS 1.3), 140 (JS 1.4), 148 (ECMA-3), 150 (JS 1.5), 160 (JS 1.6).

  Script Execution

-e script
    Command-line passed JavaScript script to execute. This is executed immediately during command line parsing, so specify it after Compile-Time Options and Run-Time Options.

-f scriptfile
    Externally passed JavaScript script to execute. This is executed immediately during command line parsing, so specify it after Compile-Time Options and Run-Time Options.

ARGUMENTS

scriptfile
    Externally passed JavaScript script to execute. This is executed after command line parsing (and this way after scripts of options -e and -f were executed. This additional way of executing an external JavaScript script exists to especially support Unix "shebang" style scripts.

scriptarg
    Zero or more arguments which are passed to the executed scriptfile. They are available in the script through the global array object arguments.

SEE ALSO
js(3), js-config(1)

    http://www.mozilla.org/js/spidermonkey/
    http://www.ossp.org/pkg/lib/js/

AUTHOR
The author of the Mozilla JavaScript language implementation ("SpiderMonkey") is Brendan Eich from the Mozilla Foundation. This manual page was written by Ralf S. Engelschall for the OSSP js distribution of Mozilla JavaScript.