5.6.3.8 fromCharCode()方法

  String构造函数本身还有一个静态方法:fromCharCode()。这个方法的任务是接收一或多个字符编码,然后将它们转换成一个字符。从本质上来看,这个方法与实例方法charCodeAt()执行的是相反的操作。例如:

alert(String.fromCharCode(104,101,108,108,111));//hello

  在上例中,我们给fromCharCode()传递的是字符串“hello”中每个字母的字符编码。

原文地址:https://www.cnblogs.com/yxlove/p/4539692.html