/* Prompt GPT to fix the errors:
- Run the function. Copy and paste the error message into ChatGPT
along with the function
- Ask the AI to explain the errors as code comments.
*/
function createCard(parentId, cardId, cardClass, title, content) {
let parentElement = document.getElementById;
let card = document.createElement('div');
card.setAttribute('id', cardId);
card.setAttribute('class', cardClass);
let cardTitle = document.createElement('h2');
cardTitle.innerText = title;
card.appendChild(cardTitle);
let cardContent = document.createElement('p');
cardContent.innerText = content;
card = cardContent;
parentElement.appendChild(card);
}
createCard('blogPreviews', 'post1', 'card', 'How to Bake Sourdough', 'A step-by-step guide to
baking your own sourdough bread at home. Learn how to create your own starter, knead the dough, and
bake to perfection.');