Skip to content

Commit

Permalink
Editorial: Define alias before reference (#2916)
Browse files Browse the repository at this point in the history
String.prototype.lastIndexOf must define _searchLen_ before using it.

(fixup for PR #2848)
  • Loading branch information
jmdyck authored and ljharb committed Sep 27, 2022
1 parent 2600c07 commit 231f270
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -33708,9 +33708,9 @@ <h1>String.prototype.lastIndexOf ( _searchString_ [ , _position_ ] )</h1>
1. Assert: If _position_ is *undefined*, then _numPos_ is *NaN*.
1. If _numPos_ is *NaN*, let _pos_ be +&infin;; otherwise, let _pos_ be ! ToIntegerOrInfinity(_numPos_).
1. Let _len_ be the length of _S_.
1. Let _searchLen_ be the length of _searchStr_.
1. Let _start_ be the result of clamping _pos_ between 0 and _len_ - _searchLen_.
1. If _searchStr_ is the empty String, return 𝔽(_start_).
1. Let _searchLen_ be the length of _searchStr_.
1. For each integer _i_ such that 0 &le; _i_ &le; _start_, in descending order, do
1. Let _candidate_ be the substring of _S_ from _i_ to _i_ + _searchLen_.
1. If _candidate_ is the same sequence of code units as _searchStr_, return 𝔽(_i_).
Expand Down

0 comments on commit 231f270

Please sign in to comment.