1. Use jQuery to detect when a keyboard key has been pressed, when that happens for the first time, call nextSequence()
.
You'll need a way to keep track of whether if the game has started or not, so you only call nextSequence()
on the first keypress.
2. Create a new variable called level
and start at level 0.
3. The h1 title starts out saying "Press A Key to Start", when the game has started, change this to say "Level 0".
4. Inside nextSequence()
, increase the level by 1 every time nextSequence()
is called.
5. Inside nextSequence()
, update the h1 with this change in the value of level.
All going well, this is what you should see when you refresh the website:
Note: If you need any hints, try scrolling down.
Hint 1. You'll need a variable called started to toggle to true once the game starts and if it's true, then further key presses should not trigger nextSequence()
.
Hint 3. The h1 has a unique id of level-title
which you can target with jQuery.
Hint 5. You'll need to use jQuery again to change the h1 by targeting the id: level-title
.