I have this code:
results.push(result);
addToLocalStorage(results);
function addToLocalStorage(results) {
localStorage.setItem("results", JSON.stringify(results));
}
Here is the list that is created when pushing the values:
So when pushing the values, a div with id of country value is created:
<div id="France"></div>
<div id="France"></div>
How can I do to not repeat another div with the same id and to not repeat that when pushing the values to the localStorage? I tried mapping the values of the countries and get the last element also from the array, but that doesn't work. I don't know in which part I am making a mistake