DEV Community

[Comment from a deleted post]
Collapse
 
chalarangelo profile image
Angelos Chalaris

Set is similar to an array, but it only contains values, not pairs. Map might be closer to what I'm talking about here, as it provides some methods such as Map.prototype.forEach() for example. Theoretically, extending Map to behave similar to an array in terms of methods would be an option to make an object that can be used much like an array. Both the solution I described above and this one have some pros and cons, so it depends on what you want to achieve.

Collapse
 
lioness100 profile image
Lioness100

One extension of Map I use incredibly frequently is Collection from @discordjs/collection. A recommend you check it out!