<div class="like">
<span class="plus">♡</span>
<span class="counter"></span>
</div>
const likes = document.querySelectorAll('.like');
likes.forEach(like => {
const plus = like.querySelector('.plus');
const counter_element = like.querySelector('.counter');
let counter = 0;
plus.addEventListener('click', () => {
render(++counter, counter_element);
});
});
const render = (counter, counter_element) => counter_element.innerText = counter;
localStorage.setItem("likes", counter.toString());
counter = parseInt(localStorage.getItem("likes") || "0");