Mark Jinx wrote:Thanks that really helped. For guessletter.indexOf('a',1), I am trying to find the location of the next 'a' that exists in the word. How would I adjust it to make it not return a -1?
It doesn't help anybody learn to provide a complete solution, least of all without explanation. I have removed it. The forum records the old text, so it is possible to restore it later.
We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
Mark Jinx wrote:How would I be able to check if the letter from the user exists in the word and then output it onto the board?