The trick is the fn function.
Experimentally, you can see that the type of the function for fn takes two parameters. The first pair contains the TYPE of the event. The second contains ... and this is not serious: an array containing the code point at index 0 and the actual event object at index 1.
So, changing your code a bit, it should look like this:
function callback(type, args) { var event = args[1];
Also, for lisp love, do not use raw code points in your code. Use โN'.charCodeAt (0) instead ofโ 78. โOr wrap it as a function
function ord(char) { return char.charCodeAt(0); }
source share