how can i create like function in javascript code example
Example: how can i create like function in javascript
const showImg = (jsonImg) => { const imageCard = document.querySelector("#image_card") imageCard.dataset.id = jsonImg.id imageCard.innerHTML = ` <img src="${jsonImg.url}" id="image" data-id="${jsonImg.id}"/> <h4 id="name">${jsonImg.name}</h4> <span>Likes: <span id="likes">${jsonImg.like_count}</span> </span> <button id="like_button">Like</button> ` const button = document.querySelector("#like_button") button.addEventListener("click", likeButton)}