JavaScript/set:修订间差异
来自康健生活
| 第19行: | 第19行: | ||
size: 6 | size: 6 | ||
[[Prototype]]: Set | [[Prototype]]: Set | ||
</pre>}}}} | |||
== 方法 == | |||
=== add === | |||
{{leftrightflex|<syntaxhighlight lang="javascript"> | |||
const _set = new Set(); | |||
_set.add(1).add(2).add(3); | |||
console.log(Array.from(_set));</syntaxhighlight>|{{consoleout|<pre> | |||
[ 1, 2, 3 ] | |||
</pre>}}}} | </pre>}}}} | ||