Annex C (informative) The Strict Mode of ECMAScript
The strict mode restriction and exceptions
-
implements,interface,let,package,private,protected,public,static, andyieldare reserved words withinstrict mode code . (11.6.2 ). -
A conforming implementation, when processing
strict mode code , must not extend, as described inB.1.1 , the syntax ofNumericLiteral to includeLegacyOctalIntegerLiteral , nor extend the syntax ofDecimalIntegerLiteral to includeNonOctalDecimalIntegerLiteral . -
A conforming implementation, when processing
strict mode code , may not extend the syntax ofEscapeSequence to includeLegacyOctalEscapeSequence as described inB.1.2 . -
Assignment to an undeclared identifier or otherwise unresolvable reference does not create a property in the
global object . When a simple assignment occurs withinstrict mode code , itsLeftHandSideExpression must not evaluate to an unresolvableReference . If it does aReferenceError exception is thrown (6.2.4.9 ). TheLeftHandSideExpression also may not be a reference to adata property with the attribute value { [[Writable]]:false }, to anaccessor property with the attribute value { [[Set]]:undefined }, nor to a non-existent property of an object whose [[Extensible]] internal slot has the valuefalse . In these cases aTypeErrorexception is thrown (12.15 ). -
An
IdentifierReference with the StringValue"eval"or"arguments"may not appear as theLeftHandSideExpression of an Assignment operator (12.15 ) or of anUpdateExpression (12.4 ) or as theUnaryExpression operated upon by a Prefix Increment (12.4.6 ) or a Prefix Decrement (12.4.7 ) operator. -
Arguments objects for strict functions define a non-configurable
accessor property "callee"which throws aTypeError exception on access (9.4.4.6 ). -
Arguments objects for strict functions do not dynamically share their
array-indexed property values with the corresponding formal parameter bindings of their functions. (9.4.4 ). -
For strict functions, if an arguments object is created the binding of the local identifier
argumentsto the arguments object is immutable and hence may not be the target of an assignment expression. (9.2.15 ). -
It is a
SyntaxError if the StringValue of aBindingIdentifier is"eval"or"arguments"withinstrict mode code (12.1.1 ). -
Strict mode eval code cannot instantiate variables or functions in the variable environment of the caller to eval. Instead, a new variable environment is created and that environment is used for declaration binding instantiation for the eval code (
18.2.1 ). -
If
this is evaluated withinstrict mode code , then thethis value is not coerced to an object. Athis value ofundefined ornull is not converted to theglobal object and primitive values are not converted to wrapper objects. Thethis value passed via a function call (including calls made usingFunction.prototype.applyandFunction.prototype.call) do not coerce the passed this value to an object (9.2.1.2 ,19.2.3.1 ,19.2.3.3 ). -
When a
deleteoperator occurs withinstrict mode code , aSyntaxError is thrown if itsUnaryExpression is a direct reference to a variable, function argument, or function name (12.5.3.1 ). -
When a
deleteoperator occurs withinstrict mode code , aTypeError is thrown if the property to be deleted has the attribute { [[Configurable]]:false } (12.5.3.2 ). -
Strict mode code may not include aWithStatement . The occurrence of aWithStatement in such a context is aSyntaxError (13.11.1 ). -
It is a
SyntaxError if aCatchParameter occurs withinstrict mode code and BoundNames ofCatchParameter contains eitherevalorarguments(13.15.1 ). -
It is a
SyntaxError if the sameBindingIdentifier appears more than once in theFormalParameters of astrict function . An attempt to create such a function using aFunction,Generator, orAsyncFunctionconstructor is aSyntaxError (14.1.2 ,19.2.1.1.1 ). -
An implementation may not extend, beyond that defined in this specification, the meanings within strict functions of properties named
callerorargumentsof function instances.