Web platform 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.

Browser support

  • 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

Usage (according to Chrome Platform Status)

~6.618% of page loads. More data at chromestatus.