JavaScript:String
lastmod 2022-03-28created 2022-03-283 edits
APIs
fromCharCode
Basic Multilingual Plane (BMP) range
The String.fromCharCode() method returns a string created from the specified sequence of UTF-16 code units.
So the range of possible values is 16 bits, from 0 to 65535 (0xFFFF). Values greater than 0xFFFF are truncated. No validity checks are performed.
| INFORMATION |
| For reference, Unicode 0x0000–0xFFFF is the Basic Multilingual Plane (BMP) range. |
Using with larger values
As anticipated during the early JavaScript standardization process, most common Unicode values can be represented as a 16-bit number, and fromCharCode() can return a single character for many common values, but fromCharCode() alone is not enough to handle all valid Unicode values (up to 21 bits). Since characters with high code points represent a single character by combining two surrogate values, the String.fromCodePoint() (ES2015 standard) method can convert such a pair into a high-value character.
fromCodePoint
The static String.fromCodePoint() method returns a string created by using the specified sequence of code points.