JS
…

Module 2 of 2

maps

Store keyed data with Map — get, set, has, and iterate.

Sets & Maps · 0/5 completed · scroll down for every challenge

Challenge 1 of 5

Create a map

Instructions

Create `ages` as a Map with `"Ada"` → 36.

Editor

IntelliSense on

// Write your code below

Challenge 2 of 5 · Set and get

Challenge 2 of 5

Set and get

Instructions

Write `setAge(map, name, age)` that sets the key and returns the map.

Editor

IntelliSense on

// Write your code below

Challenge 3 of 5 · Has key

Challenge 3 of 5

Has key

Instructions

Write `hasKey(map, key)` that returns whether the map has the key.

Editor

IntelliSense on

// Write your code below

Challenge 4 of 5 · Map size

Challenge 4 of 5

Map size

Instructions

Write `countEntries(map)` that returns `map.size`.

Editor

IntelliSense on

// Write your code below

Challenge 5 of 5 · Keys array

Challenge 5 of 5

Keys array

Instructions

Write `mapKeys(map)` returning an array of keys.

Editor

IntelliSense on

// Write your code below

Next module