js/app.js
// remember this is the event handler for image clicks
remember this is the event handler for image clicks
remember this is the event handler for image clicks
function handleImageClick(event) {
    clicksMade++;
    let imageClicked = event.target.alt;
    console.log(imageClicked);
    for (let i = 0; i < allProducts.length; i++) {
        if (allProducts[i].name === imageClicked) {
            allProducts[i].votes++;
        }
    }
    renderImages();
    if (clicksMade === ATTEMPTS_ALLOWED) {
        imageContainer.removeEventListener('click', handleImageClick);
    }
}
function handleImageClick ( event ) { clicksMade ++ ; let imageClicked = event . target . alt ; console . log ( imageClicked ) ; for ( let i = 0 ; i < allProducts . length ; i ++ ) { if ( allProducts [ i ] . name === imageClicked ) { allProducts [ i ] . votes ++ ; } } renderImages ( ) ; if ( clicksMade === ATTEMPTS_ALLOWED ) { imageContainer . removeEventListener ( 'click' , handleImageClick ) ; } }
remember this is the event handler for image clicks
remember this is the event handler for image clicks
//sometimes will see eve in the spot of event. //this is incrementing so that is counts the clicks // this is changing the image after one has been clicked.