JavaScript Code

JavaScript String fromCharCode()


String fromCharCode()

In JavaScript, String.fromCharCode() method is used to convert one or more Unicode values into a string.

Syntax

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

where

  • String is the string class.
  • fromCharCode is function name.
  • n1, n2, .., nN are Unicode values.

fromCharCode() method takes one or more Unicode values n1, n2, .., nN as arguments, are returns a string value.

Examples

1. Convert a single Unicode value to string.

const n1 = 65;
const output = String.fromCharCode(n1);
console.log(output);

2. Convert multiple Unicode values to string.

const output = String.fromCharCode(65, 80, 80, 76, 69);
console.log(output);


Copyright @2022