Intermediate
Give the viewer a keyboard
#host can take focus but ignores keys. In its keydown handler make ArrowLeft and ArrowRight turn cube by 15 degrees on rotation.y (left is minus) and handle nothing else.
Tab must not be cancelled and Ctrl with an arrow must be ignored: call preventDefault() only for keys you handled.
What Check tests
- ArrowRight turns the cube by 15 degrees
- ArrowLeft turns it back
- Tab is left alone
- Ctrl and an arrow is ignored
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.