You’re reading the English version of this content since no translation exists yet for this locale. Help us translate this article!
- You can create objects using literal notation (inspired by dictionary literal syntax from Python 1.x).
- Arrays can now be created using literal notation (inspired by list literal syntax from Python 1.x).
Other new features
- You can now nest functions within functions.
- Number now converts a specified object to a number.
- Number now produces
NaNrather than an error if
xis a string that does not contain a well-formed numeric literal.
- String now converts a specified object to a string.
Array.prototype.sort()now works on all platforms. It no longer converts undefined elements to null and sorts them to the high end of the array.
- It can take a regular expression argument, as well as a fixed string, by which to split the object string.
- It can take a limit count so that it won't include trailing empty elements in the resulting array.
String.prototype.substring(): no longer swaps index numbers when the first index is greater than the second.
toString(): now converts the object or array to a literal.
continuestatements can now be used with the new labeled statement.