Skip to content

Commit

Permalink
Editorial: Bring {%TA%,Array}#join() and Array#toLocaleString() in sy…
Browse files Browse the repository at this point in the history
…nc (#3181)

These three basically implement the same algorithm, but had minor differences in structure and variable names.
  • Loading branch information
linusg authored and ljharb committed Feb 21, 2024
1 parent b1c00ce commit c579bc2
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -39233,8 +39233,9 @@ <h1>Array.prototype.join ( _separator_ )</h1>
1. Repeat, while _k_ &lt; _len_,
1. If _k_ > 0, set _R_ to the string-concatenation of _R_ and _sep_.
1. Let _element_ be ? Get(_O_, ! ToString(𝔽(_k_))).
1. If _element_ is either *undefined* or *null*, let _next_ be the empty String; otherwise, let _next_ be ? ToString(_element_).
1. Set _R_ to the string-concatenation of _R_ and _next_.
1. If _element_ is neither *undefined* nor *null*, then
1. Let _S_ be ? ToString(_element_).
1. Set _R_ to the string-concatenation of _R_ and _S_.
1. Set _k_ to _k_ + 1.
1. Return _R_.
</emu-alg>
Expand Down Expand Up @@ -39801,11 +39802,10 @@ <h1>Array.prototype.toLocaleString ( [ _reserved1_ [ , _reserved2_ ] ] )</h1>
1. Let _R_ be the empty String.
1. Let _k_ be 0.
1. Repeat, while _k_ &lt; _len_,
1. If _k_ > 0, then
1. Set _R_ to the string-concatenation of _R_ and _separator_.
1. Let _nextElement_ be ? Get(_array_, ! ToString(𝔽(_k_))).
1. If _nextElement_ is neither *undefined* nor *null*, then
1. Let _S_ be ? ToString(? Invoke(_nextElement_, *"toLocaleString"*)).
1. If _k_ > 0, set _R_ to the string-concatenation of _R_ and _separator_.
1. Let _element_ be ? Get(_array_, ! ToString(𝔽(_k_))).
1. If _element_ is neither *undefined* nor *null*, then
1. Let _S_ be ? ToString(? Invoke(_element_, *"toLocaleString"*)).
1. Set _R_ to the string-concatenation of _R_ and _S_.
1. Set _k_ to _k_ + 1.
1. Return _R_.
Expand Down Expand Up @@ -40795,8 +40795,9 @@ <h1>%TypedArray%.prototype.join ( _separator_ )</h1>
1. Repeat, while _k_ &lt; _len_,
1. If _k_ > 0, set _R_ to the string-concatenation of _R_ and _sep_.
1. Let _element_ be ! Get(_O_, ! ToString(𝔽(_k_))).
1. If _element_ is *undefined*, let _next_ be the empty String; otherwise, let _next_ be ! ToString(_element_).
1. Set _R_ to the string-concatenation of _R_ and _next_.
1. If _element_ is not *undefined*, then
1. Let _S_ be ! ToString(_element_).
1. Set _R_ to the string-concatenation of _R_ and _S_.
1. Set _k_ to _k_ + 1.
1. Return _R_.
</emu-alg>
Expand Down

0 comments on commit c579bc2

Please sign in to comment.