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

22nd Feb 2018, 7:06 AM
gatchary forth
gatchary forth - avatar
2 odpowiedzi
0
you can use the native filter method of an Array.
24th Feb 2018, 9:48 AM
Ալվինա Գևորգյան
Ալվինա Գևորգյան - avatar
0
I bit more detail would be lovely like a actual solution being that am new to JavaScript
25th Feb 2018, 7:59 AM
gatchary forth
gatchary forth - avatar