如何使用js中的String.fromCodePoint 函数
1、语法
String.fromCodePoint(...codePoints);
2、参数
codePoints
必需。 指定一个或多个 UTF-16 码位值的 rest 参数。
3、备注
如果 ...codePoints 不是有效的 UTF-16 码位,此函数将引发 RangeError 异常。
4、示例
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
5、要求
Microsoft Edge(Edge 浏览器)中受支持。应用商店应用(Windows 10 上的 Microsoft Edge)中也受支持。请参阅版本信息。
在以下文档模式中不受支持:Quirks、Internet Explorer 6 标准模式、Internet Explorer 7 标准模式、Internet Explorer 8 标准模式、Internet Explorer 9 标准模式、Internet Explorer 10 标准模式和 Internet Explorer 11 标准模式。在 Windows 8.1 中不受支持。
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:70
阅读量:26
阅读量:172
阅读量:135
阅读量:193