Now, let’s work on the function that will be called if the user clicks the key G on the keyboard.

Implement and export the function handleKeyPress(term, state) in the handlers.js.
For the reasons that you’ll understand in the next task, we need to make it a closure. In other words
handleKeyPress(term, state) should return another function with 3 parameters (name, matches, data).

We’re only interested in the key that was pressed, and it’s stored as a code in the field data.code
You can use String.fromCharCode() to convert the code of the key into the actual symbol.
If the key is equal to G or g it should increment the property gold
of the parameter state by 1.
P.S. Remember that we import term and config only into solution.js and then forward it as term and state.
The names of these internal parameters could be chosen differently, it’s the structure that very important here.

This task is part of the Full-Stack JavaScript Course .
If you have any issues with it, you can ask for community help below the post.
Feel free to help others if you’ve already solved the task.