Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit cf37fae

Browse files
Cast .with index to a number
1 parent 7749405 commit cf37fae

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

spec.html

+4-5
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,10 @@ <h1>Array.prototype.with ( _index_, _value_ )</h1>
115115
<emu-alg>
116116
1. Let _O_ be the *this* value.
117117
1. Let _len_ be ? LengthOfArrayLike(_O_).
118-
1. If IsIntegralNumber(_index_) is *false*, throw a *RangeError* exception.
119-
1. If _index_ &ge; _len_, throw a *RangeError* exception.
120-
1. If _index_ &lt; 0, let _actualIndex_ be _len_ + _index_.
121-
1. Else, let _actualIndex_ be _index_.
122-
1. If _actualIndex_ &lt; 0, throw a *RangeError* exception.
118+
1. Let _relativeIndex_ be ? ToIntegerOrInfinity(_index_).
119+
1. If _index_ &ge; 0, let _actualIndex_ be _relativeIndex_.
120+
1. Else, let _actualIndex_ be _len_ + _relativeIndex_.
121+
1. If _actualIndex_ &ge; _len_ or _actualIndex_ &lt; 0, throw a *RangeError* exception.
123122
1. Let _A_ be ? ArrayCreate(𝔽(_len_)).
124123
1. Let _k_ be 0.
125124
1. Repeat, while _k_ &lt; _len_,

0 commit comments

Comments
 (0)