Dinosaurs

Page section: playground

The dinosaurs

Problems

The first problem was I forgot to use the return keyword.

The map() method takes an anonymous function and up to 3 values: array item, it’s index, the full array itself.

const dinosaursListed = dinosaurs.map(function (dinosaur)  {
  return '<li>' + dinosaur.name + '</li>';
});

or as an arrow function:

const dinosaursListed = dinosaurs.map((dinosaur) => {
  return '<li>' + dinosaur.name + '</li>';
});