Generation

generate functionWed, 25 Jan 2023

создать кнопку like с счетчиком нажатий и вывести в html с сохранением в localStorage

let count = localStorage.getItem('count'); count = count ? +count : 0; const btn = document.createElement('button'); btn.innerText = 'Like'; btn.onclick = () => { count++; localStorage.setItem('count', count); btn.innerText = `Like ${count}`; }; document.body.appendChild(btn);

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant