Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Set.prototype.size

这篇翻译不完整。请帮忙从英语翻译这篇文章

该新特性属于 ECMAScript 2015(ES6)规范,在使用时请注意浏览器兼容性。

Size属性将会返回Set对象中元素的个数。

说明

Size的值表示Set对象拥有多少个元素。通过调用函数的形式访问Size会提示为undefined;并且该值不能够被更改。

例子

使用

var mySet = new Set();
mySet.add(1);
mySet.add(5);
mySet.add("some text")

mySet.size; // 3

规范

Specification Status Comment

ECMAScript 2015 (6th Edition, ECMA-262)
Set.prototype.size

Standard 初始定义

ECMAScript 2016 Draft (7th Edition, ECMA-262)
Set.prototype.size

Draft  

浏览器兼容

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 38 19 (19) [1] 11 25 7.1
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 38 19.0 (19) 未实现 未实现 8

[1] From Gecko 13 (Firefox 13 / Thunderbird 13 / SeaMonkey 2.10) to Gecko 18 (Firefox 18 / Thunderbird 18 / SeaMonkey 2.15 / Firefox OS 1.0.1 / Firefox OS 1.1) the size property was implemented as a Set.prototype.size() method, this has been changed to a property in later versions conform to the ECMAScript 6 specification (bug 807001).

看这里

文档标签和贡献者

 此页面的贡献者: springuper, OmniP
 最后编辑者: springuper,