# More built-in methods for Map

**URL:** <https://es.discourse.group/t/more-built-in-methods-for-map/1486>\
**Category:** 💡 Ideas\
**Created:** [October 9, 2022, 2:21pm UTC](https://es.discourse.group/t/more-built-in-methods-for-map/1486 "2022-10-09T14:21:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![retraigo](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/retraigo/32/1525_2.png) [@retraigo](https://es.discourse.group/u/retraigo)\
**Post date:** [October 9, 2022, 2:21pm UTC](https://es.discourse.group/t/more-built-in-methods-for-map/1486/1 "2022-10-09T14:21:09Z")

</div>

Why does the `Map` class not have many built-in methods like in arrays?

Considering Map is an ordered structure, could we not have methods like `Map.prototype.find()`, `Map.prototype.sort()`, `Map.prototype.filter()`, etc? Mostly the methods that are present in an array.

---

<div class="post-metadata">

**Author:** ![bergus](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/bergus/32/152_2.png) [@bergus](https://es.discourse.group/u/bergus)\
**Post date:** [October 9, 2022, 3:01pm UTC](https://es.discourse.group/t/more-built-in-methods-for-map/1486/2 "2022-10-09T15:01:10Z")

</div>

A `Map` is not an ordered structure! Sure, it does have a well-defined iteration order to guarantee consistency between implementations and make iteration predictable and reproducible, but it is fundamentally an unordered collection. You cannot access it by index, you cannot get the index of an element, you cannot get the next element after or before another.

You can use the methods from the [_iterator helpers_ proposal](https://github.com/tc39/proposal-iterator-helpers) on the `.keys()`, `.values()` and `.entries()` iterators, and there is also the [_collection methods_ proposal](https://github.com/tc39/proposal-collection-methods).

---

<div class="post-metadata">

**Author:** ![retraigo](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/retraigo/32/1525_2.png) [@retraigo](https://es.discourse.group/u/retraigo)\
**Post date:** [October 9, 2022, 3:06pm UTC](https://es.discourse.group/t/more-built-in-methods-for-map/1486/3 "2022-10-09T15:06:13Z")

</div>

The collection methods proposal was exactly what I was looking for. Thanks!

Also, I didn't know Maps couldn't be considered an ordered structure, considering they store elements in the insertion order.
