JavaScript Map Method - Complete JS Array Methods Series

In this tutorial we are goin to learn about the JavaScript Map array method. This video is part of the Complete JavaScript Array Methods guide.

🎱 Code for this Video:


JavaScript Map Method - Complete JS Array Methods Series
Giles  Goodwin

Giles Goodwin


Maps in JavaScript

What topics we are going to cover?

  1. What are Maps?
  2. What are the methods used in it and how we can insert or retrieve values to it?
  3. How Maps works, behave with loops and what is happening behind the scenes?

What are Maps?

By the word Map, here I mean another new method which is being used these days in modern JavaScript. Here we are going to see the classic dataType of Map. Mostly Map is getting used in looping concepts that’s a great thing, but if you go directly for all those then you won’t be able to understand the classic dataType of Map.

So let’s fire up our code editor and understand the concepts of Map with some amazing examples.

var myMap = new Map();

This is almost kind of constructional approach, where we create an object from prototype and stuff like that.

What are the methods used in Maps?

Now Map has a lot of properties and I think you should take a look at it, at once. So whenever you gonna type myMap. then you can see a list of methods will be appearing on your screen like- get, set, forEach, values, and bunch of things. So one of the common methods which are being used widely is set and get method and by this time I guess from its name itself you might have guessed it like these are some default setters and getters means it can add values to them and retrieve values from them.

How to insert values in Maps?

Let’s go ahead and try with set() method and have some of the fun together:

Note: They work almost like objects but remember this, Maps are not like objects, they are completely different.

var myMap = new Map();
myMap.set(1, "Ricky"); //myMap.set(any key, any value)
myMap.set(2, "Monty"); //myMap.set(any key, any value)
myMap.set(3, "Henna"); //myMap.set(any key, any value)
myMap.set(4, "Monta"); //myMap.set(any key, any value)

Now if you try to run this code in your editor, then you gonna see an output like this on your screen.

Map(4) { 1 => 'Ricky', 2 => 'Monty', 3 => 'Henna', 4 => 'Monta' }

Notice here, how Maps by default itself is telling you that how many properties you are storing in it and one more thing you can see here they have used => these arrow between its key, value pair to differentiate, and make you understand that they are not your regular objects.

#javascript-development #maps #array-methods #arrays #javascript

Maps in JavaScript
Ollie  Dietrich

Ollie Dietrich


JavaScript Array Methods #1: Array .map() Method

Javascript array map() method creates a new array with the results of calling a provided function for every array element. It is a non-mutating method.

Syntax:, index, arr), thisValue)

β–Ά #1: Array .map() Method | JavaScript Array Methods

β–Ά JavaScript Array Methods

β–Ά Vue 2 Basics Beginner Tutorial

β–Ά Vue.js 2 Components, Beginners tutorial

β–Ά Vuex tutorial (Vue.js state management)

β–Ά Vue.js 3 Tutorial

Support my work:

  1. On BuyMeACoffee:
  2. On Patreon:

πƒπ’π π’π­πšπ₯𝐎𝐜𝐞𝐚𝐧 π‘πžπŸπžπ«π«πšπ₯

Also, follow us on:

#javascript #array #map

 JavaScript Array Methods #1: Array .map() Method
Terry  Tremblay

Terry Tremblay


Fill and Filter in Array in JavaScript

By the word Array methods, I mean the inbuilt array functions, which might be helpful for us in so many ways. So why not just explore and make use of them, to boost our productivity.

Let’s see them together one by one with some amazing examples.


The _fill()_ method changes all elements in an array to a static value, from a start index (default _0_) to an end index (default _array.length_). It returns the modified array.

In simple words, it’s gonna fill the elements of the array with whatever sets of params, you pass in it. Mostly we pass three params, each param stands with some meaning. The first param value: what value you want to fill, second value: start range of index(inclusive), and third value: end range of index(exclusive). Imagine you are going to apply this method on some date, so that how its gonna look like eg: array.fill(β€˜Some date’, start date, end date).

NOTE: Start range is inclusive and end range is exclusive.

Let’s understand this in the below example-

//declare array
var testArray = [2,4,6,8,10,12,14];


When you run this code, you gonna see all the elements of testArray will be replaced by 'A' like [β€œA”,"A","A","A","A","A","A"].

#javascript-tips #array-methods #javascript-development #javascript #arrays

Fill and Filter in Array in JavaScript
Lowa Alice

Lowa Alice


JavaScript Arrays Tutorial. DO NOT MISS!!!

Learn JavaScript Arrays

πŸ“Ί The video in this post was made by Programming with Mosh
The origin of the article:
πŸ”₯ If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free β€˜GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#arrays #javascript #javascript arrays #javascript arrays tutorial

JavaScript Arrays Tutorial. DO NOT MISS!!!

JavaScript Array Reverse Example | JS Array Reverse() Method

JavaScript Array reverse() is an inbuilt function that reverses the order of the items in an array. The reverse() method will change the original array that is why it is not a pure function. Javascript reverse() returns an array that represents the array after it has been reversed. The reverse function does not take any argument.

If you want to reverse the items of the  array then Javascript array reverse() function does the job for you.

JavaScript array reverse example

The first array item becomes the last, and the last array element becomes the first due to the array reverse() method in Javascript.

JS array reverse() method transposes the items of the calling array object in place, mutating the array, and returning a reference to the array.

The reverse() is an intentionally generic method that can be called or applied to  objects resembling arrays.

#javascript #js #js array reverse

JavaScript Array Reverse Example | JS Array Reverse() Method