C The Strict Mode of ECMAScript
The strict mode restriction and exceptions
-
implements
,interface
,let
,package
,private
,protected
,public
,static
, andyield
arereserved words withinstrict mode code . (12.7.2 ). -
A conforming implementation, when processing
strict mode code , must disallow instances of the productions andNumericLiteral :: LegacyOctalIntegerLiteral .DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral -
A conforming implementation, when processing
strict mode code , must disallow instances of the productions andEscapeSequence :: LegacyOctalEscapeSequence .EscapeSequence :: NonOctalDecimalEscapeSequence -
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 unresolvable Reference. If it does aReferenceError exception is thrown (6.2.5.6 ). 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 isfalse . In these cases aTypeError
exception is thrown (13.15 ). -
An
IdentifierReference with theStringValue "eval" or"arguments" may not appear as theLeftHandSideExpression of an Assignment operator (13.15 ) or of anUpdateExpression (13.4 ) or as theUnaryExpression operated upon by a Prefix Increment (13.4.4 ) or a Prefix Decrement (13.4.5 ) operator. -
Arguments objects for
strict functions define a non-configurableaccessor property "callee" which throws aTypeError exception on access (10.4.4.6 ). -
Arguments objects for
strict functions do not dynamically share theirarray-indexed property values with the corresponding formal parameter bindings of their functions. (10.4.4 ). -
For
strict functions , if an arguments object is created the binding of the local identifierarguments
to the arguments object is immutable and hence may not be the target of an assignment expression. (10.2.11 ). -
It is a
SyntaxError if theStringValue of aBindingIdentifier is either"eval" or"arguments" withinstrict mode code (13.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 (
19.2.1 ). -
If
this is evaluated withinstrict mode code , then thethis value is not coerced to an object. Athis value of eitherundefined 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.apply
andFunction.prototype.call
) do not coerce the passedthis value to an object (10.2.1.2 ,20.2.3.1 ,20.2.3.3 ). -
When a
delete
operator occurs withinstrict mode code , aSyntaxError is thrown if itsUnaryExpression is a direct reference to a variable, function argument, or function name (13.5.1.1 ). -
When a
delete
operator occurs withinstrict mode code , aTypeError is thrown if the property to be deleted has the attribute { [[Configurable]]:false } or otherwise cannot be deleted (13.5.1.2 ). -
Strict mode code may not include aWithStatement . The occurrence of aWithStatement in such a context is aSyntaxError (14.11.1 ). -
It is a
SyntaxError if aCatchParameter occurs withinstrict mode code andBoundNames ofCatchParameter contains eithereval
orarguments
(14.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 a Function, Generator, or AsyncFunctionconstructor is aSyntaxError (15.2.1 ,20.2.1.1.1 ). -
An implementation may not extend, beyond that defined in this specification, the meanings within
strict functions of properties named"caller" or"arguments" of function instances.