“Получить индекс в карте JavaScript” Ответ

ES6 MAP USIN INDEX

const array = [1, 2, 3, 4];


const map = array.map((x, index) => {
  console.log(index);
  return x + index;
});

console.log(map);
Graceful Grivet

Получить индекс в карте JavaScript

const array = [1, 2, 3, 4];

const map = array.map((x, index) => {
  console.log(index);
  return x + index;
});

console.log(map);
Shadowtampa

Как получить индекс объекта внутри карты JS

To find an index of the current iterable inside the JavaScript map() function, 
you have to use the callback function's second parameter. 
An index used inside the JavaScript map() method is to state the
position of each item in an array, 
but it doesn't modify the original array.
Glorious Gnu

Ответы похожие на “Получить индекс в карте JavaScript”

Вопросы похожие на “Получить индекс в карте JavaScript”

Больше похожих ответов на “Получить индекс в карте JavaScript” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования