ECMAScript® 2024 Language Specification

Draft ECMA-262 / February 15, 2024

E Corrections and Clarifications in ECMAScript 2015 with Possible Compatibility Impact

9.1.1.4.15-9.1.1.4.18 Edition 5 and 5.1 used a property existence test to determine whether a global object property corresponding to a new global declaration already existed. ECMAScript 2015 uses an own property existence test. This corresponds to what has been most commonly implemented by web browsers.

10.4.2.1: The 5th Edition moved the capture of the current array length prior to the integer conversion of the array index or new length value. However, the captured length value could become invalid if the conversion process has the side-effect of changing the array length. ECMAScript 2015 specifies that the current array length must be captured after the possible occurrence of such side-effects.

21.4.1.31: Previous editions permitted the TimeClip abstract operation to return either +0𝔽 or -0𝔽 as the representation of a 0 time value. ECMAScript 2015 specifies that +0𝔽 always returned. This means that for ECMAScript 2015 the time value of a Date is never observably -0𝔽 and methods that return time values never return -0𝔽.

21.4.1.32: If a UTC offset representation is not present, the local time zone is used. Edition 5.1 incorrectly stated that a missing time zone should be interpreted as "z".

21.4.4.36: If the year cannot be represented using the Date Time String Format specified in 21.4.1.32 a RangeError exception is thrown. Previous editions did not specify the behaviour for that case.

21.4.4.41: Previous editions did not specify the value returned by Date.prototype.toString when the time value is NaN. ECMAScript 2015 specifies the result to be the String value "Invalid Date".

22.2.4.1, 22.2.6.13.1: Any LineTerminator code points in the value of the "source" property of a RegExp instance must be expressed using an escape sequence. Edition 5.1 only required the escaping of /.

22.2.6.8, 22.2.6.11: In previous editions, the specifications for String.prototype.match and String.prototype.replace was incorrect for cases where the pattern argument was a RegExp value whose global flag is set. The previous specifications stated that for each attempt to match the pattern, if lastIndex did not change, it should be incremented by 1. The correct behaviour is that lastIndex should be incremented by 1 only if the pattern matched the empty String.

23.1.3.30: Previous editions did not specify how a NaN value returned by a comparefn was interpreted by Array.prototype.sort. ECMAScript 2015 specifies that such as value is treated as if +0𝔽 was returned from the comparefn. ECMAScript 2015 also specifies that ToNumber is applied to the result returned by a comparefn. In previous editions, the effect of a comparefn result that is not a Number value was implementation-defined. In practice, implementations call ToNumber.