donfanning
8/15/2018 - 1:05 PM

join strings in array of JSON objects using .map

join strings in array of JSON objects using .map

const ratings = [
  {
    'rank': '133',
    'category': 'Toys & Games'
  },
  {
    'rank': '3',
    'category': 'Toys & Games > Games > Board Games'
  }
];

console.log(ratings.map(rating => {
  return `${rating.category} : ${rating.rank}`;
}).join('\n'));