String.fromCodePoint
Returns a string created by using the specified sequence of code points
Syntax
String.fromCodePoint(...codePoints)Parameters
| Parameter | Type | Description |
|---|---|---|
| codePoints | number[] | Sequence of code points |
Return Value
A string created from the specified code points
Examples
console.log(String.fromCodePoint(128512)); // '😀'console.log(String.fromCodePoint(9731, 9733, 9842)); // '☃★♲'const codePoints = [72, 101, 108, 108, 111];
console.log(String.fromCodePoint(...codePoints)); // 'Hello'Understanding String.fromCodePoint
The String.fromCodePoint method in JavaScript returns a string created by using the specified sequence of code points. It belongs to the String object and is one of the most widely used methods for working with string values in modern JavaScript and TypeScript applications.
The method signature is String.fromCodePoint(...codePoints). It accepts 1 parameter: codePoints. When called, it returns a string created from the specified code points. Understanding when and how to use fromCodePoint() helps you write more expressive, readable code.
Common use cases for String.fromCodePoint include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like string-fromcharcode, string-codepointat, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for String.fromCodePoint is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
More String Methods
Other methods in the String object
Related Tools
More String Methods
Explore JavaScript Methods
Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.