今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Map: Keys and values methods
- [Instructor] Before we discuss our next two methods, keys and values, we're going to quickly review what an iterator is and how it relates to our Map. In JavaScript, we iterate over collections frequently using array methods like Map or for each. An iterator is defined by the MDN documentation as an object which defines a sequence, and potentially returns a value upon its termination. The next method is applied to the iterator and it has two properties, value and done. With our Map, some of its methods return iterators which allow us to cycle through keys and values in the order that they were inserted within our Map. Let's start with the keys method. It returns an iterator object that allows us to cycle through all of the keys found in our Map. It's likely that you would utilize this method by creating a new variable and setting it equal to your Map and then apply the keys method. Then, when you wanted to iterate over the…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
The Map object defined1 分钟 23 秒
-
(已锁定)
Build your Map object with the set method4 分钟 41 秒
-
(已锁定)
Access a value with get3 分钟 51 秒
-
(已锁定)
Does the map have your key?3 分钟 4 秒
-
(已锁定)
Determine map size2 分钟 6 秒
-
(已锁定)
Remove key-value pairs with clear and delete4 分钟 23 秒
-
(已锁定)
Map: Keys and values methods5 分钟 44 秒
-
(已锁定)
Map contents with the entries method2 分钟 32 秒
-
(已锁定)
Loop over a map with forEach2 分钟 38 秒
-
(已锁定)
Group entries with groupBy3 分钟 22 秒
-
(已锁定)
Solution: Maps 12 分钟
-
(已锁定)
Solution: Maps 21 分钟 32 秒
-
-
-
-
-