You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>This method returns a String representation of this object with all leading surrogates and trailing surrogates that are not part of a surrogate pair replaced with U+FFFD (REPLACEMENT CHARACTER).</p>
34622
+
<p>It performs the following steps when called:</p>
34623
+
<emu-alg>
34624
+
1. Let _O_ be ? RequireObjectCoercible(*this* value).
34625
+
1. Let _S_ be ? ToString(_O_).
34626
+
1. Let _strLen_ be the length of _S_.
34627
+
1. Let _k_ be 0.
34628
+
1. Let _result_ be the empty String.
34629
+
1. Repeat, while _k_ < _strLen_,
34630
+
1. Let _cp_ be CodePointAt(_S_, _k_).
34631
+
1. If _cp_.[[IsUnpairedSurrogate]] is *true*, then
34632
+
1. Set _result_ to the string-concatenation of _result_ and 0xFFFD (REPLACEMENT CHARACTER).
34633
+
1. Else,
34634
+
1. Set _result_ to the string-concatenation of _result_ and UTF16EncodeCodePoint(_cp_.[[CodePoint]]).
34635
+
1. Set _k_ to _k_ + _cp_.[[CodeUnitCount]].
34636
+
1. Return _result_.
34637
+
</emu-alg>
34638
+
</emu-clause>
34639
+
34609
34640
<emu-clause id="sec-string.prototype.trim">
34610
34641
<h1>String.prototype.trim ( )</h1>
34611
34642
<p>This method interprets a String value as a sequence of UTF-16 encoded code points, as described in <emu-xref href="#sec-ecmascript-language-types-string-type"></emu-xref>.</p>
0 commit comments