Project

Hangman (JavaScript)

Challenging
556 completions
~ 7 hours
4.1

With functions, loops, arrays and other variables, this is a great project for JavaScript basics. As a cherry on top, it even includes a random module. Don’t be intimidated by the number of stages; they ensure that your dive into JavaScript is safe and smooth.

Provided by

JetBrains Academy JetBrains Academy

About

Hangman is a popular yet grim puzzle game. A cruel computer hides a word from you, which you try to guess letter by letter. If you fail, you'll be “hanged”. If you win, you'll survive. You’ve probably played the game at least once or twice. Now you can actually create this game yourself!

Graduate project icon

Graduate project

This project covers the core topics of the Introduction to JavaScript course, making it sufficiently challenging to be a proud addition to your portfolio.

At least one graduate project is required to complete the course.

What you'll learn

Once you choose a project, we'll provide you with a study plan that includes all the necessary topics from your course to get it built. Here’s what awaits you:
At this stage, the player will have only one chance to guess the word. Learn how to use “Input” and “if” to implement the most basic version of the game.
Make the game more challenging! Now it will randomly choose one of four words from a list.
Enable hints in your game. Allow it to show the number of letters and the first three letters. Slicing will help you to implement this part.
Using a loop, extend the number of attempts to eight. Now we’re talking!
The outcome of the game may be “fatal”: a feature that makes the game all the more exciting. Work on implementing this feature so that players don’t lose “lives” if they guess the letter correctly. The While loop will help.
Improve the game by handling different error cases. Repetition of a letter, entering words that are too long, or using non-Latin characters shouldn’t cost your player a life.
Dinner at a restaurant starts with the menu; our project ends with one. Create a menu for your game so that players can replay it or exit.

Reviews

Pavel Shchegolevatykh
4 months ago
Nice gameplay, no difficulties except for character replacement initially.
David Alves avatar
David Alves
7 months ago
In this project, I learned how to structure a complete console application using JavaScript. One of the main challenges was managing the game state (resetting variables like attempts and the revealed word) when restarting the game. I overcame this by refactoring the code and encapsulating the game l ...
Myster D
8 months ago
Great for beginner with at least 6-7/10 in programming experience.

4.1

Learners who completed this project within the Introduction to JavaScript course rated it as follows:
Usefulness
4.2
Fun
4.0
Clarity
4.1