Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript fromCharCode() Method

JavaScript fromCharCode() Method

String Object Reference JavaScript String object

Example

Convert a Unicode encoding into a character:

var n = String.fromCharCode(65);

n Output result:

A

Try it »


Definition and Usage

fromCharCode() accepts a specified Unicode value and returns a string.

**Note:** This is a static method of String. Each character in the string is specified by a separate Unicode numeric encoding. Syntax: String.fromCharCode().


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The fromCharCode() method is supported by all major browsers


Syntax

String.fromCharCode(

n1

,

n2

, ...,

nX

)

Parameter value

Parameters Description
n1, n2, ..., nX Required. One or more Unicode values, i.e. the Unicode encodings of the characters to be created in the string.

Return Value

Type Description
String Returns the character representing the Unicode encoding.

Technical Details

JavaScript version: 1.2

More examples

Example

Convert a Unicode encoding into a string:

var n = String.fromCharCode(72,69,76,76,79);

n Output result:

HELLO

Try it »


String Object Reference JavaScript String object