ARTICLE AD BOX
JavaScript represents strings as their UTF-16 representation, a series of 16-bit (2-byte) code units. So str.charCodeAt(i) gives you the ith code unit as a number that ranges from 0x0000 (0) to 0xFFFF (65535). The operation str.charCodeAt(i) & 0xFF uses the bitwise AND operator (&) and produces a number corresponding to just the last 8 bits (1 byte) of that number, ranging from 0x00 (0) to 0xFF (255). It basically just discards the first byte of that number. If the input was already in that range, nothing changes. Otherwise you're losing information. See What does charCodeAt(...) & 0xff accomplish?.
In the specific instance where the character is NARROW NO-BREAK SPACE whose Unicode code point is 0x202F (8239), the last byte is 0x2F (47), which is the Unicode code point for SOLIDUS (forward slash). Note how this is fairly obvious when you use the hexidecimal representations of the numbers, which are directly related to the binary representations, but seems somewhat mysterious when you use the decimal representations.
That's the answer to the question as asked. You can expect all kinds of weird outputs if your inputs are outside the one-byte Basic Latin range of Unicode code points.
So, you... you definitely don't want to convert strings this way. It will turn anything outside of Basic Latin into gibberish for all consumers. It is almost certainly better to convert the string to a UTF-8-encoded representation. This will be the same for Basic Latin text. For characters outside that range you'll get a representation that is likely to be understood by the average consumer, and only gibberish to those consumers who don't speak UTF-8. And if you're using modern JavaScript, then you've already got a TextEncoder that can do this, and your stringToArrayBuffer() method could be replaced by simply
private stringToArrayBuffer(str: string) { return new TextEncoder().encode(str); }(maybe you want to reuse a TextEncoder instance? but this is already outside the scope of the question as asked.)
