Guess | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Guess

How do I restrict the number of guesses user has to guess a word in JavaScript

22nd Apr 2018, 3:59 PM
love
2 Answers
+ 3
I would advise the same logic as Adam did (though I reversed it to track remaining instead of the current guess number). See the code: https://code.sololearn.com/Wh3jmbi3r1mb
22nd Apr 2018, 5:24 PM
ServantCoder
ServantCoder - avatar
+ 1
set up a counter. and every time they guess increment it by 1. check if counter < limit.
22nd Apr 2018, 4:38 PM
Adam
Adam - avatar