How Collection() works?

collection | Collection
A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has an ID, for significantly improved performance and ease-of-use.
7 Replies
d.js toolkit
d.js toolkit12mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Squid
Squid12mo ago
It's just a class that extends the native Map class
Gonzaliito
Gonzaliito12mo ago
Can you give me an example?
Squid
Squid12mo ago
const collection = new Collection() ?
Gonzaliito
Gonzaliito12mo ago
Is like an array but better? To improved performance
Squid
Squid12mo ago
Look at the embed from your link
A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has an ID, for significantly improved performance and ease-of-use.
Gonzaliito
Gonzaliito12mo ago
ok, thanks