Exercise 2: Maps
Test your understanding of Maps in this challenge.
We'll cover the following
Problem statement
In this exercise, you are required to use Map
to get the desired output as given in the sample input calls and output section.
Upon creating an object of createTodo()
, it returns a map element.
Sample input calls and outputs
The input calls and their respective outputs are given in the table below.
Input calls | Output |
---|---|
console.log(todo.get('learn JavaScript')); |
‘done’ |
console.log(todo.get('write elegant code')); |
‘work-in-progress’ |
console.log(todo.get('automate tests')); |
‘work-in-progress’ |
console.log(completedCount(todo)); |
1 |
Exercise
Complete this exercise to test your Map
implementation knowledge and skills. The solution to this challenge is given in the next lesson, but we want you to try it yourself first.
Get hands-on with 1400+ tech skills courses.