Skip to content

JavaScript fromCharCode() function | convert Unicode example

  • by

JavaScript fromCharCode is used to convert Unicode values to characters. This method can convert one or more Unicode values. This method returns a string created from the specified sequence of UTF-16 code units.

String.fromCharCode(n1, n2, ..., nX)

JavaScript fromCharCode example

Simple example code.

<!DOCTYPE html>

   let char = String.fromCharCode(65);

   let text = String.fromCharCode(72, 69, 76, 76, 79);       




JavaScript fromCharCode function

More Examples

String.fromCharCode(65, 66, 67);   // returns "ABC"
String.fromCharCode(0x2014);       // returns "—"
String.fromCharCode(0x12014);      // also returns "—"; the digit 1 is truncated and ignored
String.fromCharCode(8212);         // also returns "—"; 8212 is the decimal form of 0x2014

Do comment if you have any doubts or suggestions on this JS JavaScript from the Char Code method topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *