CKTIS / JavaScript
String.fromCodePoint — create text from code points
String.fromCodePoint creates a string from Unicode code points, including values above 0xFFFF. It automatically encodes them as UTF-16; invalid numeric values cause RangeError.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
String.fromCodePoint(...codePoints)String.fromCodePoint(...codePoints) is a static method of String, not a method on an individual string. It returns a string containing the supplied code points in argument order. With no arguments, it returns "".
Each argument is converted using ToNumber. The result must be an integer from 0 through 0x10FFFF, inclusive. Fractions, NaN, infinities, and out-of-range values cause RangeError. Arguments of type BigInt or Symbol cause TypeError during conversion.
Unlike String.fromCharCode, which accepts UTF-16 code units, String.fromCodePoint accepts entire code points. A value above 0xFFFF is encoded as a surrogate pair, increasing the string's .length by two. .length counts code units, not code points or visible characters.
The method also accepts surrogate values 0xD800–0xDFFF; it therefore does not guarantee well-formed UTF-16. This is an ECMAScript language API, not a browser API. Check availability in the target environment with typeof String.fromCodePoint === "function".
Examples
const text = String.fromCodePoint(0x41, 0x1F600);
console.log(text);
console.log(text.length);
console.log(text.codePointAt(1) === 0x1F600);
console.log(String.fromCodePoint() === "");Result
A😀 3 true true
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.