TypeScript String.fromCharCode() Method
Last Updated :
24 Apr, 2025
The fromCharCode() is an inbuilt TypeScript String method. It mainly changes Unicode code points within the Basic Multilingual Plane (BMP) into strings. Although it provides a method for dealing with characters through typing on a keyboard it has restrictions when it comes to characters, outside the BMP.
Syntax:
String.fromCharCode(...codePoints: number[]): string
Parameters:
- codePoints: One or more Unicode code points to be converted into characters.
Return Value:
A string that contains characters whose Unicode points were passed as an argument within the method.
Example 1: In this example here we are creating a string from unicode code point values.
JavaScript
let codeUnits: number[] =
[
71, 101, 101, 107, 115, 70,
111, 114, 71, 101, 101, 107, 115
];
let geeksString: string = String
.fromCharCode(...codeUnits);
console.log(geeksString);