JavaScript fromCharCode()Method

String 对象参考手册JavaScript String Object

Example

Convert Unicode encoding to a character:

var n = String.fromCharCode(65);

nOutput:

A

Try it Yourself »

Definition and Usage

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

Note:This method 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

method All major browsers support the fromCharCode() method


Syntax

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

Parameter Values

Parameter Description
n1, n2, ..., nX Required. One or more Unicode values, that is, the Unicode encoding of the characters in the string to be created.

Return Value

Type Description
String Returns the character representing the Unicode encoding.

Technical Details

JavaScript Version: 1.2


More Examples

Example

Convert Unicode encoding to a string:

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

nOutput:

HELLO

Try it Yourself »


String 对象参考手册JavaScript String Object

Other Extensions