今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Same methods, different set
- [Instructor] As we learned in the previous lesson a WeakSet has a few of the same methods as Set. These are add, has, and delete. At this point in the course, these methods and how they operate should be very familiar to you. We're going to review each method and then conclude this lesson by implementing each of them with WeakSet. The first method is add. We will use this method to construct our WeakSet. Remember with WeakSets, our values must be objects. You simply apply the add method to your WeakSet and pass in your value. Next is the has method. This method returns a boolean depending on whether or not your WeakSet has a specific value. You apply the method to your WeakSet and pass in the value that you're checking for. And last but not least, the delete method. This method will remove a value from your WeakSet based on the value you pass to the method when applied to your WeakSet. That was a quick review but I think…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。