HTML and CSS Reference
In-Depth Information
this is no longer coerced to an object in strict mode. In ES3 and non-strict
ES5, this will be coerced to an object if it is not one already. For instance, when
using call or apply with function objects, passing in null or undefined will
no longer cause this inside the called function to be coerced into the global object.
Neither will primitive values used as this be coerced to wrapper objects.
8.3.2.3 Objects, Properties, and Variables
eval and arguments cannot be used as identifiers in ES5 strict mode. Formal
parameters, variables, the exception object in a try-catch statement, and object
property identifiers are all affected by this restriction.
In ES3 implementations, defining an object literal with repeated property iden-
tifiers causes the latest one to overwrite the value of previous properties sharing
the identifier. In strict mode, repeating an identifier in an object literal will cause a
syntax error.
As we already saw, strict mode does not allow implicit globals. Not only will im-
plicit globals cause errors, but writing to any property of an object whose writable
attribute is false , or writing to a non-existent property of an object whose internal
[[Extensible]] property is false will throw TypeError as well.
The delete operator will no longer fail silently in strict mode. In ES3 and
non-strict ES5, using the delete operator on a property whose configurable
attribute is false will not delete the property, and the expression will return false
to indicate that the deletion was not successful. In strict mode, such deletion causes
a TypeError .
8.3.2.4 Additional Restrictions
The with statement no longer exists in strict mode. Using it will simply produce a
syntax error. Some developers are less than impressed by this change, but the truth
is that it is too easy to use wrong, and easily makes code unpredictable and hard to
follow.
Octal number literals, such as 0377 ( 255 decimal), are not allowed in strict
mode, this also applies to parseInt("09") .
8.4 Various Additions and Improvements
We have already seen most of the additions to the Object , but there is more to
ECMAScript 5 than empowered objects.
 
 
Search WWH ::




Custom Search