StringfromCodePoint
String.fromCodePoint is a static method of the JavaScript String object that creates a string from a sequence of Unicode code points. It was introduced in ECMAScript 2015 (ES6) to allow representation of characters beyond the Basic Multilingual Plane by encoding them as UTF-16 surrogate pairs.
- String.fromCodePoint(codePoint1, codePoint2, ...) takes one or more code points as arguments.
- Each code point is treated as a non-negative integer in the range 0 to 0x10FFFF. Decimals are
- The method returns a string composed of the corresponding Unicode characters. Code points above 0xFFFF are
- String.fromCodePoint(0x1F600) yields the grinning face emoji: 😀.
- String.fromCodePoint(0x41, 0x42, 0x43) yields "ABC".
- It is more convenient than String.fromCharCode for representing full Unicode code points, especially those outside the
- String.fromCharCode operates on UTF-16 code units and cannot reliably represent code points above 0xFFFF without manual
- Code point-aware methods such as String.prototype.codePointAt retrieve a full code point from a string, while fromCodePoint
- Modern JavaScript environments support String.fromCodePoint. Polyfills are available for older runtimes that lack this method.