If I set the value to find as a variable, why doesn't it work?
When calling the findProd function with the number 1, everything works correctly. However, if I replace the number 1 with the idToFind variable, the console outputs undefined. Why is this happening? P.S. in my file, if I print idToFind, the result is 1. addToCartButtons.forEach(button => { button.addEventListener(‘click’, (event) => { const idToFind = event.target.dataset.id; let… Read More If I set the value to find as a variable, why doesn't it work?