What is the string fromCodePoint() method in JavaScript?

The method fromCodePoint() takes a sequence of code pointsUnicode assigns an integer value to each character, known as a code point. and returns the string that corresponds to those code points.

Syntax

String.fromCodePoint(num1, ..., numN)

Parameters

Two or more integer parameters, where each num represents a code point.

num1, ..., numN - A sequence of code points.

Return value

The method returns a string that corresponds to these code points. Note that a string is returned and not a String object.

fromCodePoint() method throws a RangeErrorif an invalid Unicode code point is provided as an argument.

Code

Let’s look at a code example. We can see that the ASCII value of 'A' is 65, 'B' is 66, etc. The code points represent these ASCII values.

let str = String.fromCodePoint(65, 66, 67, 68, 69);
console.log(str); // ABCDE
let str1 = String.fromCodePoint(65, 89, 90, 78, 79);
console.log(str1); // AYZNO

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved