String.prototype.toWellFormedintermediate'hello'.toWellFormed() // β 'hello'
'π'.toWellFormed() // β 'π'
'οΏ½'.toWellFormed() // β 'οΏ½'Use toWellFormed() to replace lone surrogate code units with the Unicode replacement character U+FFFD (ES2024).
In a string that contains both normal characters and a lone surrogate, only the surrogate is replaced.
Challenge: Implement fixMixed() that returns the well-formed version of 'ab\uD800cd'.
fixMixed() // β 'abοΏ½cd'