IIRC Java also allows unpaired surrogates? But does consider non-BMP codepoints to be single characters. I think. Idk.
So from JSs point of view it is a fixed-width encoding, one where all byte values are valid. `"\uD83D\uDC68".match(/\ud83d/)` works (U+D83D is a high surrogate, and "\uD83D\uDC68" is U+1F468 MAN), so the regex engine operates on code units, not code points.
I think for Java the regex engine would have to deal with it as a variable-width encoding, though.
Edit: Hacker News removes emoji from comments.