String.fromCharCode()

Creates a string from a sequence of UTF-16 code units.

Since ES1 Spec ↗

Syntax

String.fromCharCode(...codeUnits)

Parameters

NameTypeRequiredDescription
codeUnits number No One or more numbers between 0 and 65535 representing UTF-16 code units.

Returns

string — A string created from the given code units.

Examples

console.log(String.fromCharCode(72, 105));
Output
Hi
console.log(String.fromCharCode(65));
Output
A

Notes

Works with 16-bit code units, so characters above U+FFFF require surrogate pairs. Use `String.fromCodePoint` for full code points. It is a static method on String, not an instance method.

Browser & runtime support

EnvironmentSince version
chrome 1.0
firefox 1.0
safari 1.0
edge 12
node 0.10

See also