Reserved Words as Identifiers

In ECMAScript, reserved words are identifiers that have special meaning. For example, the reserved word var indicates a variable declaration. You can't use reserved words as variable names, labels, or function names in JavaScript or ECMAScript. Since SuiteScript 2.1 supports a newer ECMAScript version (ECMAScript 2023) than SuiteScript 2.0 (ECMAScript 5.1), the list of reserved words is different. SuiteScript 2.1 is stricter about not letting you use reserved words in scripts.

Scenario

SuiteScript 2.0 Behavior

SuiteScript 2.1 Behavior

You use the extends identifier in one of the following ways in a script:

                    myObj({extends: 'test'});
function myFunction(extends) {}
function extends() {}
var extends = 1; 

                  

The script executes and does not generate an error. The extends identifier is not a reserved word in ECMAScript 5.1.

The script generates a syntax error. The extends identifier is a reserved word in ECMAScript 2023.

To avoid this issue, don't use any reserved words from any edition of ECMAScript (including those planned for future editions using ES.Next). For more information, see SuiteScript Reserved Words.

Related Topics

General Notices