Skip to main content

fromCodePoint() JavaScript Method – How to Convert Unicode Code Point to String

Whenever you invoke fromCodePoint(), the method returns the string representation of its Unicode code point arguments.

Syntax of the fromCodePoint() Method

fromCodePoint() accepts one or more arguments. Here is the syntax:

String.fromCodePoint(codepoint1, codepoint2, ..., codepointX)

The codepoint arguments represent the Unicode codepoints you wish to convert to string.

note

We use fromCodePoint() as String.fromCodePoint() because it is a static method of the default JavaScript String object rather than a method of an object you created.

Examples

Below are examples of the fromCodePoint() method.

How to convert one code point argument to a string

String.fromCodePoint(73);

// The invocation above will return: "I"

Try Editing It

The snippet above returned the string representation of Unicode code point 73.

How to convert three code point arguments to string

String.fromCodePoint(73, 32, 128150);

// The invocation above will return: "I 💖"

Try Editing It

The snippet above returned the string representation of Unicode code points 73, 32, and 128150.

How to convert sixteen code point arguments to string

String.fromCodePoint(
73,
32,
128150,
32,
67,
111,
100,
101,
83,
119,
101,
101,
116,
108,
121,
33
);

// The invocation above will return:
// "I 💖 CodeSweetly!"

Try Editing It

The snippet above returned the string representation of fromCodePoint()'s arguments.

tip

To convert a JavaScript string to a Unicode code point, use codePointAt().

Overview

fromCodePoint() is a string method that converts one or more Unicode code points to their string representation.

Join CodeSweetly Newsletter