Open da0ka opened 2 years ago
Interestingly, the code reference I used was modified since :
https://codereview.stackexchange.com/questions/37512/count-byte-length-of-string
And the edition removes tests for values > 65535, as you suggest, and it also mentions that the computed length for characters in astral planes (i.e. represented by surrogates) is wrong:
> getByteLength( '😀' )
6 // should be 4
Thus, issue is a bug, not simply a code simplification.
stringHelper.js: charCodeAt returns 0-65535 or NaN. And unicode range is 0-65535. so line 32-34 50-52 is unnecessary. btw
1 << 31
is-2147483648
, soc < (1 << 31)
is always false