VM

The VM object provides you an interface for running code inside SpiderMonkey sandbox.

run(script[, options]) (static)

Compile and run JavaScript code.

Arguments:
script

(String | Stream | ArrayBuffer): The code to execute

options (Object)

Options

scope (Object)

A JavaScript object that will be added to the scope

filename (String)

Specifies the filename used in stack traces produced by this script

lineOffset (Integer)

Specifies the line number offset that is displayed in stack traces produced by this script

sandbox (Object)

An object representing a sandbox.

debugger (Boolean)

true if you want to initialize a Debugger object inside the sandbox. Default to false

Returns: Any

The completion value of evaluating the given code. If the completion value is empty, undefined is returned.


Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!

  • Static methods