Web features explorer

String isWellFormed() and toWellFormed()

Newly available since 2023-10-24
Tags: javascript Groups: JavaScript > Primitive types > Strings

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

Specifications