I'm working on a JavaScript Hangman game and I need to print out the same number of dashes as the length of the word chosen at random. Iv'e done that but it also prints out a dash for the gaps that are in the sentence, so how can I ignore these spaces and only print out a dash for the letters in the sentence? Any help appreciated Thanks.
This is the code that prints the dashes out
for(var i = 0; i < sayings[randomSaying].length; i++)
{
progress.innerHTML += "-";
}
Random Variable
var sayings = [
"cash on the nail",
"charley horse",
"foul play",
"bury the hatchet",
"hands down",
"if the cap fits",
"mumbo jumbo",
"see red",
"stone the crows",
"thick and thin",
]
sayings.toString();
var randomSaying = Math.floor(Math.random()*sayings.length);