javascript
Execute the given JavaScript source code, returning the result. This is equivalent to calling PolyglotContext.evaluate and selecting JavaScript as source language.
Return
The result of the invocation. If esm is true
, an object is returned, with exported values as members.
Parameters
The JavaScript source code to be executed.
Whether to treat the source as an ESM module. If false, the code is evaluated as CommonJS source.
Name to provide for this script.
Whether to treat this code as "internal" to the runtime; this also exposes primordials
.
Whether this script should run interactively; defaults to false
.
Whether to allow source-base caching; defaults to true
.
Addressable URI to this source code; defaults to null
. Generated on-the-fly if not provided.
Unlocks internal APIs even if a source script is not part of the runtime internals; this is mostly useful for testing and benchmarking/debugging.
Execute the given JavaScript Source, returning the result. This is equivalent to calling PolyglotContext.evaluate and selecting JavaScript as source language.
Return
The result of the invocation; an object is returned, with exported values as members.
Parameters
The interpreted JavaScript source code to be executed.