今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Remove key-value pairs with clear and delete - JavaScript教程
课程: JavaScript: Maps and Sets
Remove key-value pairs with clear and delete
- [Instructor] In this lesson, we're going to cover two map methods that remove key value pairs from your map, delete and clear. The first method we will discuss is delete. The delete method will remove a specified key value pair from your existing map. Like many other methods, this is straightforward and you'll pass a key in order to execute the operation. If the key value pair is successfully deleted it will return the Boolean value true. If the key pass does not match any key value pairs in the map, it will return false. Next, we have the clear method. The clear method removes all elements or key value pairs from a map. This method returns a value of undefined. However, you could confirm that your map was successfully cleared by logging its size which we learned about that property in the previous lesson. Looking at our meals example, we will first delete the dessert key because we have a cookie emoji as a key in our…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
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 秒
-
-
-
-
-