You're designing a caching mechanism for user sessions where each user ID maps to session data. Which ES6 data structure would be most suitable?

  • Map
  • Set
  • WeakMap
  • WeakSet
In this scenario, a Map would be most suitable. A Map in ES6 allows you to associate keys (user IDs) with values (session data), making it an ideal choice for a caching mechanism where you need to map user IDs to their respective session data.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *