Working with Maps and Symbols

In this chapter, we will cover the following recipes:

  • Using Symbol to create a local instance
  • Using Symbol.for to create a global instance
  • Using Symbol to simulate enums
  • Setting and deleting entries from Map
  • Creating a Map from the existing data
  • Creating a class that wraps Map to work with specific complex types
  • Setting and deleting entries from WeakMap
  • Creating a WeakMap from existing data
  • Creating a class that uses WeakMap to work with specific complex types

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.