06. Keyboard Events πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

πŸ“– Implement Keyboard Events to Display Value and Code of Pressed Key

Work with a partner to implement the following user story:

  • As a developer, I want to display the value and code of a pressed key.

Acceptance Criteria

  • It’s done when, if a key is pressed down, the value of the key and the key’s code is displayed. KEYDOWN Event should also be displayed to indicate the type of event.

  • It’s done when, if the key is released, KEYUP Event is displayed.

πŸ“ Notes

Refer to the documentation:

MDN Web Docs on keyup

MDN Web Docs on keydown

Assets

The following image demonstrates the web application’s appearance and functionality:

The web app includes lines to display "Key Pressed", "Key Code", and "Event status".


πŸ’‘ Hints

What properties can we use to access the value of the pressed key and the key’s code?

πŸ† Bonus

If you have completed this activity, work through the following challenge with your partner to further your knowledge:

  • What other properties can you access using the KeyboardEvent object?

Use Google or another search engine to research this.


βœ… Solutions

Solutions Click Here