What is fromCodePoint() Method in JavaScript ?
Last Updated :
12 Feb, 2024
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, ...)
codePoint1, codePoint2, ...
: One or more Unicode code points (numeric values representing characters) to be converted into a string.
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
.
Javascript
const str = String.fromCodePoint(65, 66, 67);
console.log(str);
|
Share your thoughts in the comments
Please Login to comment...