Files
freeCodeCamp/guide/chinese/javascript/standard-objects/string/string-fromcharcode/index.md
2018-10-16 21:32:40 +05:30

35 lines
868 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: String fromCharCode
localeTitle: 字符串fromCharCode
---
静态`String.fromCharCode()`方法返回使用指定的Unicode值序列创建的字符串。
## 句法
```
String.fromCharCode(num1[, ...[, numN]])
```
### 参数
**num1...numN**
一系列Unicode值的数字。
[MDN链接](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode) | [MSDN链接](https://msdn.microsoft.com/en-us/LIBRary/wb4w0k66%28v=vs.94%29.aspx)
## 描述
此方法返回字符串而不是String对象。
因为`fromCharCode()`是String的静态方法所以始终将其用作`String.fromCharCode()` 而不是您创建的String对象的方法。
## 例子
```
String.fromCharCode(65, 66, 67); // "ABC"
var test = String.fromCharCode(112, 108, 97, 105, 110);
document.write(test);
// Output: plain
```