I'm trying to create a JavaScript function that allows me with a click to save the last element of an array (standbyWord array) and then have that saved element appear as an HTML <li>.
I have managed to change the innerHTML, so each time the save button is clicked the last element from the standbyWord array is saved in the savedWords array. However, I would like that each time the save button is pushed a new <li> appears with that new saved word.
<div>
<ul>
<li id="listWord"></li>
</ul>
</div>
let savedWords = [];
function saveWord(){
savedWords.push(standbyWord[standbyWord.length - 1]);
document.getElementById('savedWordCount').innerHTML = savedWords.length;
document.getElementById('listWord').innerHTML = savedWords;
}