The Set object defined
- [Instructor] Like Map, sets were introduced with ES6, otherwise known as ES2015. The key feature of Set is that it is a collection of unique values, meaning you can not have duplicates of values in the set and those values can be anything. Sets can be a really powerful tool in your JavaScript programming. I'm sure you can think of some everyday examples where limiting a collection to unique values would be really helpful. Set comes with several methods as well as the size property. Many of these methods and their execution will be very similar to you after having learned about Map and WeakMap. You even initialize in the same manner. A set is initiated using new Set. Throughout this section, we will work through some examples together and give you a chance to try some things on your own. In the next lesson we'll get started with adding values to our set.
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
The Set object defined57 秒
-
(已锁定)
Add values to your set3 分钟 17 秒
-
(已锁定)
Does Set have your value?3 分钟 9 秒
-
Get your set size2 分钟 2 秒
-
(已锁定)
Delete and clear values in your set2 分钟 46 秒
-
(已锁定)
Iterate over values in a set2 分钟 45 秒
-
(已锁定)
Iterate over a set with entries2 分钟 25 秒
-
(已锁定)
Iterate over your set with forEach2 分钟 29 秒
-
(已锁定)
Solution: Sets 12 分钟 8 秒
-
(已锁定)
Solution: Sets 22 分钟 35 秒
-
-
-