2.1.46 [ECMA-262/9:2018] Section 21.2.5.2.3 AdvanceStringIndex ( S, index, unicode )
V0173: AdvanceStringIndex advances the index by 1, not 2, when the unicode flag is specified
The specification states:
-
21.2.5.2.3 AdvanceStringIndex ( S, index, unicode ) The abstract operation AdvanceStringIndex with arguments S, index, and unicode performs the following steps: 1. Assert: Type(S) is String. 2. Assert: index is an integer such that 0≤index≤2^53-1. 3. Assert: Type(unicode) is Boolean. 4. If unicode is false, return index+1. 5. Let length be the number of code units in S. 6. If index+1 ≥ length, return index+1. 7. Let first be the code unit value at index index in S. 8. If first < 0xD800 or first > 0xDBFF, return index+1. 9. Let second be the numeric value of the code unit ["code unit value" prior to 2018] at index index+1 in S. 10. If second < 0xDC00 or second > 0xDFFF, return index+1. 11. Return index+2.
EdgeHTML Mode
AdvanceStringIndex advances the index by 1, not 2 when the unicode flag is specified. For example, the following should hold:
/\udf06/u.exec('\ud834\udf06') == null
Instead exec
returns \udf06;
that is:
/\udf06/u.exec('\ud834\udf06') == '\udf06'