---
title: "Comment by Jorge Romero on \"JavaScript: Arrays vs Objects General Overview\" | Hashnode"
description: "One of the most fascinating things I have learned through my JavaScript journey is how to shift the way you think about these programming constructs. It is true"
url: "https://hashnode.com/posts/javascript-arrays-vs-objects-general-overview/6219b38345bf7fc41cc9b331/comment/6224d606d858116153ef1007"
---

[Discussion](https://hashnode.com/posts/javascript-arrays-vs-objects-general-overview/6219b38345bf7fc41cc9b331)

Comment [JavaScript: Arrays vs Objects General Overview](https://hashnode.com/posts/javascript-arrays-vs-objects-general-overview/6219b38345bf7fc41cc9b331)

[Jorge Romero](https://hashnode.com/@JorgeRL)

[Mar 6, 2022](https://hashnode.com/posts/javascript-arrays-vs-objects-general-overview/6219b38345bf7fc41cc9b331/comment/6224d606d858116153ef1007)

One of the most fascinating things I have learned through my JavaScript journey is how to shift the way you think about these programming constructs.

It is true that objects and arrays are different and serve different purposes. Yet, there is a sense in which they are _the same thing_.

For example, you can use `Array.map(f)` to apply a function `f` to every element of the array and return the resulting array. But you can also define a similar `map()` for any data structure that could reasonably be iterated through.

It turns out that it often is very desirable to do this shift in thinking, given the current hype with functional programming (which I really like) :)
