Quiz

  1. Can you talk more about Keydown and Keyup

    Sure. Distinguishing between up and down allows us to do shift keys, click-and-drag and gestures like that.

    They are events, and the browser calls our event handler with an event object

    That event object allows us to tell what key went up or down.

  2. Can we talk more about the concept of a closure. / more on closures and when we would use them / Could you elaborate on how closures can come in handy?

    Closures are so cool. Very often, we have a function that will be called with a particular set of arguments (maybe none) that we don't have control over, but, we need that function to have some additional information in some variables.

    We could use global variables for that information, but then no one else can use that global variable. Global variables should, in general, be minimized.

    Furthermore, all five click handlers in Ottergram needed to use the thumb variable, and they can't all use the same global variable for that.

    Closures allow each function to have its own variable for its use.

  3. There is nothing more I would like to talk about. / Everything was clear!

    Amazing!