Open In App

What is fromCodePoint() Method in JavaScript ?

In JavaScript, the String.fromCodePoint() method is used to create a string from a sequence of Unicode code points. It allows you to generate a string using Unicode code points, which represent characters in the Unicode standard. Unicode code points are numerical values that represent characters. So, instead of using characters directly, you can use their code points to generate a string.

Syntax:

String.fromCodePoint(codePoint1, codePoint2, ...)

Example: Here, the String.fromCodePoint() method is called with the Unicode code points 65, 66, and 67, which represents the characters "A", "B", and "C" respectively. The method generates a string containing these characters and assigns it to the variable str.




const str = String.fromCodePoint(65, 66, 67);
console.log(str); // Output: "ABC"

Output
ABC

Article Tags :