今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Does Set have your value?
- [Instructor] Depending on what you're working on, you may simply need to check whether or not a value exists in your Set. This is where the Has Method can be very helpful. It's usage is identical to that in Maps and WeakMap. The Has Method is applied to your existing Set, passing the value that you're checking for in the Set. If the Set has the value, true will be returned, if not, false will be returned, pretty straightforward, right. Now let's move to our birthday invitations example and see how this might work in a real world example. In this example, we want to see if Sue and Sally are included in our invite Set. First, we will check to see if Sue exists in our Set. She does, so the return value is true. In the second example we want to see if Sally exists in the set and she does not, so false is returned. All right, let's head to our editor and try an example together. Similar to how we did with Map, we're going…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
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 秒
-
-
-