Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.
  • Madrid
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store

JavaScript modes

Log in to subscribe to topics and get notified when content changes.

JavaScript modes

To support existing scripts and new scripts developed to the ECMAScript5 standard, the JavaScript engine has two modes. The modes are Compatibility Mode and ES5 Standards Mode. The JavaScript engine dynamically determines which mode to use on a script-by-script basis.

Compatibility mode

Compatibility mode is used for all scripts developed prior to the Helsinki release, and all global scripts. Compatibility mode has some differences from the old JavaScript engine.

JSON support changes.
  • JSON.stringify() and JSON.parse() are now implemented using the ES5 Native JSON object.
  • The new JSON().encode() and new JSON().decode() are still supported, but should only be used when the legacy behavior is required.

The use of 3rd party JavaScript libraries is not supported in Compatibility mode.

ES5 Standards mode

ES5 Standards mode is the default when you create new scoped scripts. This mode does not preserve the legacy behaviors in the pre-Helsinki JavaScript engine.

ES5 standards mode supports ECMAScript5 syntax and features, including the following.
  • The ‘use strict’ declaration
  • Control over extensibility of objects
  • Get and set properties on objects (accessors)
  • Control over write-ability, configurability, and enumer-ability of object properties
  • New Array and Date methods
  • Native JSON support
  • Support for modern third-party libraries such as lodash.js and moment.js