5 hands-on exercises and 5 find-the-bug challenges for the JavaScript Map Methods lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Spread the keys into an array and join them.
Add up every value in the Map.
Build a line using the value and the key.
Turn the Map into a plain object and read a property.
Build a Map from an object and read a value.
In a Map forEach the value comes first, then the key.
keys returns an iterator, which has no array methods.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceThe numbers are the values, not the keys.
Object.fromEntries is what converts the pairs.
A Map needs pairs, which Object.entries produces.