JavaScript (ES2026) reference · String Methods
JavaScript String.fromCharCode() Method
Create a string from UTF-16 code units, for example String.fromCharCode(72, 105) gives "Hi".
JavaScript (ES2026) Since ES1
Syntax
String.fromCharCode(code1, code2, /* …, */ codeN)
Parameters
| Parameter | Description |
|---|---|
codes |
Numbers between 0 and 65535. |
Return value
A string.
Examples
console.log(String.fromCharCode(72, 105));
Output
Hi
const letters = Array.from({ length: 5 }, (_, i) => String.fromCharCode(65 + i));
console.log(letters.join(""));
Output
ABCDE
Version history
| Version | Change |
|---|---|
| JavaScript ES1 | Added |
In other languages
Related
String.fromCodePoint()· Create a string from Unicode code points, including emoji outside the BMP that fromCharCode() can't express in one number.string.charCodeAt()· Return the UTF-16 code unit (0 to 65535) at an index. For emoji and other astral characters use codePointAt().- JavaScript Strings · tutorial
- JavaScript String Methods · tutorial