freeCodeCamp/guide/english/javascript/standard-objects/string/string-fromcodepoint/index.md

1.7 KiB

title
String FromCodePoint

String.fromCodePoint

String.fromCodePoint returns a string from a list or sequence of code points.

Description

You can use this static String method to create a string based on a sequence of code points. Basically, a code point is any value that exist in a code-space, such as Unicode.

Syntax

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

Parameters

num1, ..., numN

A sequence of code points.

Examples

String.fromCodePoint(24);       // '\u0018'
String.fromCodePoint(42);       // '*'
String.fromCodePoint(45);       // '-'
String.fromCodePoint(10);       // '\n'
String.fromCodePoint(18);       // '\u0012'
String.fromCodePoint(18123);    // '䛋'
String.fromCodePoint(194564);   // '你'
String.fromCodePoint(0x0113);   // 'ē'

More Information:

MDN Article

Differences between fromCharCode and fromCodePoint

Discussion in StackOverflow about the differences between Character, Code Points, Code Units

Unicode Glossary: Code Point

Here is a very short video (< 4 min) explaining what Unicode and character encoding is.