DEV Community

Lautaro Suarez
Lautaro Suarez

Posted on

1

What`s new Map()?

Lets talk about whats "new Map()".

Uses
We could use it to define a new object where then calling the key we would be able to get the value on the specific value.

Usage
The usage of it is as follows.

First we will see how we declare the variable "objMap" as the "new Map()" object will have.
Then we will set the value it will have calling "objMap" and the internal function "Map()" have. The first value we pass to it will be the key of the object. For example: If we just pass "objMap.set("1", "Hola")", the value will be "Hola" and the key will be "1".
And finally there are examples of how to get the values doing different console.logs, we will see that the first one will return "Hola" and the second console.log will return undefined cause the is not a "2" key.

Image description

This post is to explain the concept used in the last post.

Hope someone found it useFul.

Lautaro

Do your career a favor. Join DEV. (The website you're on right now)

It takes one minute and is worth it for your career.

Get started

Top comments (0)

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay