JavaScript 引擎 V8 发布 8.1 版本

JavaScript 引擎 V8 发布了 8.1 版本(测试阶段),正式版本将于几周后随 Chrome 81 一起推出。8.1 版本带来了一些面向开发人员的特性。

新的 Intl.DisplayNames API 使开发者可以轻松显示语言、区域、脚本和货币的翻译。

const zhLanguageNames = new Intl.DisplayNames(['zh-Hant'], { type: 'language' });
const enRegionNames = new Intl.DisplayNames(['en'], { type: 'region' });
const itScriptNames = new Intl.DisplayNames(['it'], { type: 'script' });
const deCurrencyNames = new Intl.DisplayNames(['de'], {type: 'currency'});

zhLanguageNames.of('fr');
// → '法文'
enRegionNames.of('US');
// → 'United States'
itScriptNames.of('Latn');
// → 'latino'
deCurrencyNames.of('JPY');
// → 'Japanischer Yen'

详情查看更新说明:

https://v8.dev/blog/v8-release-81

猜你喜欢

转载自www.oschina.net/news/113656/v8-8-1-released