String.fromCodePoint Function (JavaScript)

Returns the string associated with a Unicode UTF-16 code point.

Syntax

String.fromCodePoint(...codePoints);  

Parameters

...codePoints
Required. A rest parameter that specifies one or more UTF-16 code point values.

Remarks

This function throws a RangeError exception if ...codePoints is not a valid UTF-16 code point.

Example

The following example shows how to use the fromCodePoint function.

var str1 = String.fromCodePoint(0x20BB7);  
var str2 = String.fromCodePoint(98);  
var str3 = String.fromCodePoint(97, 98, 99);  

if(console && console.log) {  
    console.log(str1);  
    console.log(str2);  
    console.log(str3);  
}  

// Output:  
// 𠮷  
// b  
// abc   

Requirements

Supported in Microsoft Edge (Edge browser). Also supported in Store apps (Microsoft Edge on Windows 10). See Version Information.
Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not supported in Windows 8.1.