ES6 - 集合设置属性 size

返回 Set 对象中的值的数量。

语法

Myset.size

示例

var mySet = new Set('tom','jim','jack'); 
var tot = mySet.size; 
console.log(tot);

输出

3