官术网_书友最值得收藏!

The API difference

The API difference as documented in WeakMap case of maps is pretty close to what you can find for Sets as well:

  • Set.prototype.size: Returns the size of the set
  • Set.prototype.add: Adds a value for a given element and returns the entire new set
  • Set.prototype.delete: Deletes an element and returns true if delete was successful, otherwise false
  • Set.prototype.has: Checks the set for the presence of an element and returns a Boolean
  • Set.prototype.clear: Clears the set and returns nothing
  • Set.prototype.forEach: Loops over the set and gives access to each element
  • Set.prototype.values: Returns an iterator, which can be used to get access to the next value
  • Set.prototype.keys: Similar to values—returns access to values in the set

WeakSet, on the other hand, does not contain the forEach(), keys(), and values() methods for reasons discussed previously.

主站蜘蛛池模板: 综艺| 郴州市| 兴隆县| 随州市| 富平县| 德江县| 呼玛县| 禄劝| 高阳县| 肃宁县| 泸水县| 大城县| 宜君县| 宁津县| 东丰县| 电白县| 固阳县| 扎鲁特旗| 和静县| 信宜市| 玛沁县| 东光县| 延津县| 图木舒克市| 富蕴县| 惠东县| 西吉县| 农安县| 巫溪县| 阿拉善盟| 德兴市| 手游| 乌兰浩特市| 库车县| 旺苍县| 江川县| 眉山市| 新营市| 永修县| 那曲县| 汝城县|