var artists = []; // zaczynamy od pustej tablicy

artists.push({
  name: "Pablo Picasso",
  bornYear: 1881,
  deathYear: 1973,
  numberOfWorks: 50000
});

artists.push({
  name: "Leonardo Da Vinci",
  bornYear: 1452,
  deathYear: 1519,
  numberOfWorks: 30
});

artists.push({
  name: "Claude Monet",
  bornYear: 1840,
  deathYear: 1926,
  numberOfWorks: 2500
});

for (var i = 0; i < artists.length; i = i + 1) {
  document.body.innerText = document.body.innerText + artists[i].name + " zmarł w wieku " + (artists[i].deathYear - artists[i].bornYear) + " lat.\n";
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.