Running JavaScript on GraalVM can be configured with several options.

GraalVM JavaScript Launcher Options

These options are to control the behaviour of the js launcher:

GraalVM JavaScript Engine Options

There are several options to configure the behavior of the GraalVM JavaScript engine. Depending on how the engine is started, the options can be passed either to the launcher or programmatically.

For a full list of options of the JavaScript engine, pass the --help:js flag to the js launcher (available from GraalVM 22.1., for older releases use --help:languages). To include internal options, use --help:js:internal. Note that those lists both include stable, supported options and experimental options.

Provide Options to the Launcher

To the launcher, the options are passed with --js.<option-name>=<value>:

js --js.ecmascript-version=6

Provide Options Programmatically Using the Context API

When started from Java using GraalVM’s Polyglot API, the options are passed programmatically to the Context object:

Context context = Context.newBuilder("js")
                         .option("js.ecmascript-version", "6")
context.eval("js", "42");

See the Polyglot Programming reference for information on how to set options programmatically.

Stable and Experimental Options

The available options are distinguished in stable and experimental options. If an experimental option is used, an extra flag has to be provided upfront.

In the native launchers (js and node), --experimental-options has to be passed before all experimental options. When using a Context, the option allowExperimentalOptions(true) has to be called on the Context.Builder. See ScriptEngine Implementation on how to use experimental options with a ScriptEngine.

Frequently Used Stable Options

The following stable options are frequently relevant:

For a complete list, use js --help:js:internal

ECMAScript Version

This option provides compatibility to a specific version of the ECMAScript specification. It expects an integer value, where both the counting version numbers (5, 6, …) and the publication years (starting from 2015) are supported. As of GraalVM 21.2, latest, staging are supported, too. The default in GraalVM 22.x is the ECMAScript 2022 specification. GraalVM JavaScript implements some features of the future draft specification and of open proposals, if you explicitly select that version and/or enable specific experimental flags. For production settings, it is recommended to set the ecmascript-version to a released, finalized version of the specification (e.g., 2022).

Available versions are:


This option enables ECMAScript’s Internationalization API. It expects a Boolean value and the default is false.

Strict Mode

This option enables JavaScript’s strict mode for all scripts. It expects a Boolean value and the default is false.

Frequently Used Experimental Options

Note that these options are experimental and are not guaranteed to be maintained or supported in the future. To use them, the --experimental-options flag is required or the experimental options have to be enabled on the Context, see above.