js String.fromCharCode

创建日期: 2024-08-20 14:29 | 作者: 风波 | 浏览次数: 15 | 分类: 前端

文档:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode

String.fromCharCode()

The String.fromCharCode() static method returns a string created from the specified sequence of UTF-16 code units.

Example

console.log(String.fromCharCode(189, 43, 190, 61));
// Expected output: "½+¾="

Syntax

String.fromCharCode()
String.fromCharCode(num1)
String.fromCharCode(num1, num2)
String.fromCharCode(num1, num2, /* …, */ numN)

Parameters

num1, , numN

A number between 0 and 65535 (0xFFFF) representing a UTF-16 code unit. Numbers greater than 0xFFFF are truncated to the last 16 bits. No validity checks are performed.

Return value

A string of length N consisting of the N specified UTF-16 code units.

15 浏览
0 评论