Espero que alguien pueda decirme qué estoy haciendo mal aquí. Al intentar registrar el valor de artistBox en la función hideProductCard, devuelve 'indefinido'. Sin embargo, al registrar el valor de artistBox en la función addArtistSelection, regresa con el valor correcto. ¿Por qué está pasando esto? Ambas funciones, como se ve en los condicionales 'if/else if', toman el mismo parámetro y se pasa a ambas funciones, pero solo una funciona.
// Adding Artist Selection let artistCheckBoxes = document.querySelectorAll('.artist-filter-input'); let artistProductCards = document.querySelectorAll('.store-card'); artistCheckBoxes.forEach((artistBox) => { artistBox.addEventListener('click', () => { if (artistBox.checked === true) { addArtistSelection(artistBox); hideProductCard(artistBox); } else if (artistBox.checked === false) { document.getElementById(`${artistBox.value}-selection`).remove(); } }); }); let addArtistSelection = (artistBox) => { let artistSelectionContainer = document.querySelector('.artist-selection-container'); let artistSelection = document.createElement('p'); artistSelection.classList = 'filter-selection artist-selection'; artistSelection.id = `${artistBox.value}-selection`; artistSelection.innerHTML = ` ${artistBox.value} `; artistSelectionContainer.appendChild(artistSelection); }; let hideProductCard = (artistBox) => { artistProductCards.forEach((productCard) => { console.log(productCard.querySelector('.card-title').innerText); console.log(artistBox.value); }); };