@kuzubina

Как получить первое значение в каждом массиве js?

Есть массив такого вида:
[ { home_score: '4', away_score: '6' },
  { home_score: '4', away_score: '6' } ]
[ { home_score: '3', away_score: '6' },
  { home_score: '2', away_score: '6' } ]
[ { home_score: '6', away_score: '1' },
  { home_score: '6', away_score: '0' } ]
[ { home_score: '6', away_score: '3' },
  { home_score: '6', away_score: '1' } ]
[ { home_score: '6', away_score: '3' },
  { home_score: '5', away_score: '7' },
  { home_score: '6', away_score: '4' } ]
[ { home_score: '6', away_score: '2' },
  { home_score: '7', away_score: '5' } ]
[ { home_score: '6', away_score: '3' },
  { home_score: '3', away_score: '6' },
  { home_score: '4', away_score: '6' } ]
[ { home_score: '4', away_score: '6' },
  { home_score: '6', away_score: '3' },
  { home_score: '6', away_score: '2' } ]
[ { home_score: '6', away_score: '4' },
  { home_score: '5', away_score: '7' },
  { home_score: '6', away_score: '1' } ]

Как вывести в консоль все первые значения home_score?
  • Вопрос задан
  • 111 просмотров
Решения вопроса 1
hzzzzl
@hzzzzl
massiv.map(elem => elem[0].home_score)
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
fakemancat_fmc
@fakemancat_fmc
Node.js разработчик
array.map(element => element.home_score)
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы