JavaScript String String.fromCharCode() method
- Προηγούμενη σελίδα endsWith()
- Επόμενη σελίδα includes()
- Επιστροφή στο προηγούμενο επίπεδο Εγχειρίδιο Αναφορών JavaScript String
Definition and usage
String.fromCharCode()
The method converts Unicode values to characters.
String.fromCharCode()
It is a static method of the String object.
The syntax is always String.fromCharCode()
.
You cannot use myString.fromCharCode().
Example
How to convert Unicode values to characters:
let char = String.fromCharCode(65);
let text = String.fromCharCode(72, 69, 76, 76, 79);
Syntax
String.fromCharCode(n1, n2, ... , nX)
Parameter
Parameter | Description |
---|---|
n1, n2, nX | Required. One or more Unicode values to be converted. |
Return value
Type | Description |
---|---|
String | A string representing a unicode character. |
Tip:For a list of all Unicode values, please read our complete Unicode reference manual.
Technical details
Return value
A new string containing characters with specified encoding.
Description
This static method provides a way to create a string, where each character in the string is specified by a separate Unicode encoding number.
Note:As a static method,fromCharCode()
It is a property of the constructor String() and not a method of a string or String object.
charCodeAt()
It is associated with fromCharCode()
An instance method used in conjunction with it, which provides a method to obtain the encoding of a single character in a string.
Browser support
String.fromCharCode()
It is ECMAScript1 (ES1) feature.
All browsers fully support ES1 (JavaScript 1997):
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Υποστήριξη | Υποστήριξη | Υποστήριξη | Υποστήριξη | Υποστήριξη | Υποστήριξη |
- Προηγούμενη σελίδα endsWith()
- Επόμενη σελίδα includes()
- Επιστροφή στο προηγούμενο επίπεδο Εγχειρίδιο Αναφορών JavaScript String