0
Remove duplicate key from array push using textContent
I have a an array that writes letters from a-z and it writes duplicate values to my html, I want to prevent it from writing duplicate values how do I do this Document.onkeyup = function (event) { If (event.keyCode >= 65 && event.keyCode <= 90 && gameStarted) { LettersGuessed.push(event.key.toLowerCase()); LettersGuessedHolder.textContent=lettersGuessed.join(‘, ); } } So letters guessed goes into that array .join but I want to omit duplicate entries any suggestions. Please
2 Respuestas
0
you can use the native filter method of an Array.
0
I bit more detail would be lovely like a actual solution being that am new to JavaScript