Per discussion on the wiki recently [0] as well as two years ago [1], the now de-facto standard behavior of splice with a single argument should be included in the ES6 specification.
[0] https://mail.mozilla.org/pipermail/es-discuss/2012-July/023875.html
[1] https://mail.mozilla.org/pipermail/es-discuss/2010-October/012012.html
The title should be "Array.prototype.splice" and not "String.prototype.splice".
I’ve documented this here, for now: http://mathias.html5.org/specs/javascript/#array.prototype.splice
This can easily be fixed in the ECMAScript spec by adding an extra step to the algorithm (http://ecma-international.org/ecma-262/5.1/#sec-15.4.4.12) saying:
> If `deleteCount` is `undefined`, set the value of `deleteCount` to `Infinity`.
Tests: http://mathias.html5.org/tests/javascript/array/
In Chrome at least array.splice() will return [], so stating `undefined` won't
work as also `array.splice(start, void 0) currently is treated as`0`. It seems
to be only when the arguments.length of `Array#splice` is equal to 1 that the
extension kicks in.
Good catch, JDD! Actually, another special case applies to the first argument.
I guess something among the lines of the following could be added to the algorithm:
1. If the `start` argument is omitted (`arguments.length == 0`), set its value to `Infinity`.
2. If the `deleteCount` argument is omitted (`arguments.length < 2`), set its value to `Infinity`.
(I’ve updated the abovementioned spec and tests.)
There is no need to address the `arguments.length` equals `0` case as the existing logic/rules in the spec cover it. For the case of `arguments.length` equals `1` the `actualDeleteCount` would be `len – actualStart`.
fixed in rev17 editor's draft
fixed in rev17, August 23, 2013 draft