String isWellFormed() and toWellFormed()
Newly available since 2023-10-24
The isWellFormed()
method of strings returns a boolean indicating if the string contains any Unicode lone surrogates. The toWellFormed()
method returns a new string where all lone surrogates are replaced by the Unicode replacement character.
To learn more, see
String.prototype.isWellFormed(),
String.prototype.toWellFormed() at MDN.
Compatibility
- Chrome 111 Released on 2023-03-07
- Chrome Android 111 Released on 2023-03-07
- Edge 111 Released on 2023-03-13
- Firefox 119 Released on 2023-10-24
- Firefox for Android 119 Released on 2023-10-24
- Safari 16.4 Released on 2023-03-27
- Safari on iOS 16.4 Released on 2023-03-27
Specifications
- ECMAScript Language Specification (#sec-string-objects), from TC39 (Ecma International).