Keyboard polling
If you played the game from the last chapter, you may have noticed that the movements from left to right from our "frog" are somewhat strange, that is, if you press and hold the left key, your avatar will move left a bit, stall for some time, and start moving left continually.
This behavior is not directly caused by the browser, but rather by the operating system. What's happening here is that the OS will repeat any key when it stays pressed long enough (also known as "sticky keys"). There are two parameters that define this behavior:
The grace period: This is the time during which the OS will wait before repeating the keys. This avoids repeating the keys when you really mean to press them once.
The frequency at which the keys will repeat.
You have no control on those parameters or on the occurrence of this behavior. It all depends on the OS and the way the user configured it.
For continuous actions, this is far from ideal. If you move an avatar around in an RPG or a platformer...