isWellFormed < String < JavaScript
The isWellFormed() of a String returns a boolean indicating whether the string contains any lone surrogates.
const loneLeadingSurrogate = "ab\uD800".isWellFormed();
console.log(loneLeadingSurrogate)
// false
const loneTrailingSurrogate = "\uDFFFab".isWellFormed();
console.log(loneTrailingSurrogate)
// false
const wellFormed = "abc".isWellFormed();
console.log(wellFormed)
// true
const wellFormed2 = "ab\uD83D\uDE04c".isWellFormed();
console.log(wellFormed2)
// true