Intl.Locale.prototype.getNumberingSystems()
getNumberingSystems() 方法属于 Intl.Locale 实例,用于返回该区域设置的一个或多个唯一 数字系统 标识符的列表。
注意: 在某些浏览器的一些版本中,此方法被实现为一个名为 numberingSystems 的访问器属性。然而,因为它每次访问都会返回一个新的数组,所以现在它被实现为一个方法,以防止 locale.numberingSystems === locale.numberingSystems 返回 false 的情况。详情请查看 浏览器兼容性表格。
语法
js
getNumberingSystems()
参数
无。
返回值
一个字符串数组,表示该 Locale 常用的所有数字系统,按偏好降序排列。如果 Locale 已经有一个 numberingSystem,那么返回的数组将只包含该单个值。
支持的数字系统类型列表,请参阅 Intl.supportedValuesOf()。
示例
获取支持的数字系统
如果 Locale 对象还没有 numberingSystem,getNumberingSystems() 将列出给定 Locale 常用的所有数字系统。有关显式设置 numberingSystem 的示例,请参阅 numberingSystem 示例。
js
const arEG = new Intl.Locale("ar-EG");
console.log(arEG.getNumberingSystems()); // ["arab"]
js
const ja = new Intl.Locale("ja");
console.log(ja.getNumberingSystems()); // ["latn"]
规范
| 规范 |
|---|
| Intl Locale Info Proposal # sec-Intl.Locale.prototype.getNumberingSystems |
浏览器兼容性
加载中…