30 Days Of JavaScript

Day 2: Collection Types

Lesson 4: Maps

In programming a map is basically a fancy name for an object, you'll hear the term in a number of places. In JavaScript it is basically an object with some rules about how they work.

Maps differ from objects in a few ways:

  • Can only set or remove values with .set() and .delete() methods
  • Have to be created with a constructor new Map()
  • A key can be any data type, not just a string
  • Maps know the order their data was added in
  • They know their size
  • Are iterable (we'll come on to this later)

And that's really it. Maps are technically better than objects but in reality objects are so quick and easy to use in JavaScript, most people just stick to using them.

Outline

Go Pro?

Upgrade to Pro for quizzes, tracked progress and a completion certificate for just $25 🚀

Want more developer tips, tricks and tools?
Then follow me:
FREE Coding Career Quick Start Guide 🚀
Discover the best way to learn to code, how to land a job and valuable resources to help your journey in this free 15 page value packed guide.
Looking to email me? You can get me on my first name at allthecode.co