I am making a Pure js hangman game. I have an array with different words. I have tried to split the array into single letters, but I am getting "," for every letter.
e.g: in array [station], when I split it returns "s,t,a,t,i,o,n".
so i want to split it with out the ",".
here is the code:
// Word we want to use to the hangman game
let words = ["definition", "programming", "relation", "station","gamification","playstation"];
//This chooses random word from words array and * with words length to not go over the array length
let random = Math.floor(Math.random(words) * words.length);
//This will split up the word ex: station to [s,t,a,t,i,o,n]
let wordSplit = words[random].split('');
let wordLetters = document.getElementById("letters")
wordLetters.innerHTML = wordSplit;
function wordInput(){
let lettersDiv = document.getElementById("letters");
let html = "<p id = 'letters'>" + wordSplit + "</p>";
return html;
}