I wrote a bot for conversations vk on nodejs. I make the game hangman. I have for example "XXXX" - here the word DAD. If the person entered the team and the letter A was shown the letter A in that place, it stands. If the answer is not true then otherwise. In general, how can I check for the presence of a letter and show its location!?

  • And what have you tried to do? What exactly did not work and caused difficulties? Please provide the code sections in which you had difficulties - Kir_Antipov
  • I do not know how to make a check for the presence of a letter in this word. That is the difficulty. - Dady

1 answer 1

Seriously? Read the string methods here.

let letter = 'Я', string = 'БАТЯ' string.indexOf(letter)