trying to write a javascript quiz for my coding bootcamp. having some issues with retrieving and saving previous high scores from local storage. can someone please explain to me why the below code writes the newScore TWICE to the highScores arrayItems array into local storage? obviously i would not like duplicates. everything else works great except for this! please help me. thank you so much!

```
// load any existing high scores from local storage as array

let scoresArray = localStorage.getItem('highScores') ? JSON.parse(localStorage.getItem('highScores')) : [];

// save the score and intials to local storage in array

let newScore = [document.querySelector("#initialsInput").value, '' + countdownTimer + ''];
scoresArray.push(newScore);

localStorage.clear("highScores");

localStorage.setItem('highScores', JSON.stringify(scoresArray));

// run the high scores function which will show all high scores, storted and give the user a chance to play again

showHighScores();

```

thanks for your quick replies. im sorry i was able to supply you with all of the info you needed, but i thought i gave you enough to work with.

i was just writing to let you know i did figure out a work around. while i'm still getting the duplicate entries into the array, before writing it to localstorage i am using a very simple jquery method to remove any duplicates from my array. here's what i ended up doing:

```
 var uniqueNames = [];
        $.each(scoresArray, function (i, el) {
            if ($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
        })

```