Latest web development tutorials

JavaScript fromCharCode () method

String Object Reference JavaScript String Object

Examples

The Unicode encoding into a character:

var n = String.fromCharCode(65);

n output:

A

try it"

Definition and Usage

fromCharCode () accepts a specified Unicode values ​​and returns a string.

Note: This method is a static method of String, each character in the string by a separate numeric Unicode encoding specified.Using the syntax: String.fromCharCode ().


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

method in all major browsers support fromCharCode () method


grammar

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

Parameter Value

参数 描述
n1 , n2 , ..., nX 必需。一个或多个 Unicode 值,即要创建的字符串中的字符的 Unicode 编码。

return value

类型 描述
String 返回代表 Unicode 编码的字符。

technical details

JavaScript version: 1.2


More examples

Examples

The Unicode encoding is converted to a string:

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

n output:

HELLO

try it"


String Object Reference JavaScript String Object