But an object *is* a key/value structure.

It's a case of:

const lookup = {

'foo': 1,

'bar': 2,

'baz': 3

};

versus

const lookup = new Map();

lookup.set('foo', 1);

lookup.set('bar', 2);

lookup.set('baz', 3);

To my mind, at least, the object declaration is a lot more readable than the Map.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Aurelia Fenderson-Peters
Aurelia Fenderson-Peters

Written by Aurelia Fenderson-Peters

20+ years writing code of various sorts. Full of trans magic.

Responses (1)

Write a response

By definition, yes. But for the use cases exposed in the article, I believe that Map is the most appropriate, since it came about precisely to provide this type of behavior. In addition, it brings a set of methods such nomenclature makes reading more enjoyable. Objects have a broader and more generic purpose.

--