.forEach get values from array item

I have an array with several elements like this:

const initialCards = [
  {
    name: "el-name",
    link: "pic-url.jpg",
  }

and a function which creates post articles based on html template

initialCards.forEach(createCard);

right now it only is able to create empty templates, because it fails to get name and link from array items. How do I do that?

I think you will need to show us more of your code, such as the part that is creating the template. To display your code in here you need to wrap it in triple back ticks. On a line by itself type three back ticks. Then on the first line below the three back ticks paste in your code. Then below your code on a new line type three more back ticks. The back tick on my keyboard is in the upper left just above the Tab key and below the Esc key.

Are you building this on a shareable platform like CodePen? If so, please share your project so we can get the full picture and better help you.

function createCard(card, index, initialCards) {
    const name = card.name;
    const link = card.link;
}