Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

4

728
Visualizações
What does the map method do?

In JS map it is responsible for generating a response array from a function applied to an input array

over 4 years ago · José Alejandro Vargas Gutiérrez
12 Respostas
Responde à pergunta

0

Basically it allows you to loop through an object and/or an array of objects in a new item.

over 4 years ago · Sergio Andres Campbell Villarreal Relatório

0

Basically it allows you to loop through an object and/or an array of objects in a new item.

over 4 years ago · Sergio Andres Campbell Villarreal Relatório

0

Iterates through an object but returns numbers different from the original object

over 4 years ago · Jesus Miguel Tirado Puello Relatório

0

map allows you to manipulate an array response more efficiently without having to normally generate loops and whiles to iterate through all the vector items

over 4 years ago · Juan Burgos Herrera Relatório

0

CREATE A NEW ARRANGE STARTED WITH ANOTHER

over 4 years ago · MARVIN BLAS DE LA PEÑA GUZMAN Relatório

0

acts as a for

over 4 years ago · Valeria Lucia Navarro Garcia Relatório

0

In a nutshell, it walks through the placed array.

over 4 years ago · Iosef Dali Ayala Huaringa Relatório

11

In more descriptive terms it creates a new array with the results applied in the method.

Example:

We are going to map an array to find the numbers greater than 2.

we have our first array that we will call array1

 array1 = [1, 2, 3, 4]

To create the map method is as follows:

yourArray.map (receivesAnItem => returnsTheResultAppliedToYourElements)

So we're going to use the map method to find out which numbers are greater than 2.

 newArray = array1.map(num => num > 2)

This would return:

 console.log(newArray); result: [false, false, true, true]

In cases more developed in the labor field, it is used a lot for JSON, such as:

 myJson = [ { "name": "Pepito", "age": 20, }, { "name": "Juan", "age": 28 } ]

Let's map this JSON to get the names.

 newJson = myJson.map(item => item.name)

This would return a new array with the elements that would be the names.

 console.log(newJson); result: ['Pepito', 'Juan']

over 4 years ago · Santiago Trujillo Relatório

4

It goes through an array and returns a new one, with the result of the operations or processes applied to each item of the collection.

over 4 years ago · Yesid Dávila Sierra Relatório

5

The map method in Javascript allows us to use an array to create a new one, which is the result of the return of a function that we pass as an argument, in said function we can do any process on each element of the array, to then return an element that will be part of the new array.

 let nums = [1,5,6,8,7] let powOddNums = nums.map(function(element){ if(element % 2 !== 0 ){ return element * element } return element }) result: [1,25,6,8,49]
over 4 years ago · Carlos Yeric Fonseca Rios Relatório

1

The textual definition indicates that it creates a new array from an existing one, but this relative to what we do in the callback function is passed as an argument, you can even use the map without taking the result to a variable (myArray.map(element => {only view element})).

In conclusion, the map method loops through an array, extracting each element of an existing array in order.

over 4 years ago · Edwin Arley Gomez Mendez Relatório

1

The Map object holds key-value pairs and remembers the original insertion order of the keys. Any value (both objects and primitive values) may be used as either a key or a value.
A Map object iterates its elements in insertion order — a for...of loop returns an array of [key, value] for each iteration.

Objects vs. Maps

Object is similar to Map—both let you set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key. For this reason (and because there were no built-in alternatives), Object has been used as Map historically.

However, there are important differences that make Map preferable in some cases:

If you want to learn more about map of javascript, please read this article.....
Good Luck...

over 4 years ago · Marko Kujacic Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda