to get information about what key was pressed, I now use following code:
function AddEventListeners() {
document.getElementById('txtHangman').addEventListener('keypress', TextHangman.bind(this), false);
}
And then the eventhandler function:
function TextHangman(_key) {
var _keypressed = _key.which || _key.key;
}
The code works and gives me the information I want but I don't understand what the || operator does when initiliazing the var _keypressed. Some explanation would be great.
Thanks!
G