First, thank you for sharing your idea.
... and then wouldn't fit in this tiny code box
Do you realize that whether or not code fits into a non-scrolling code box is dependent upon such things as choice of browser, screen resolution, browser window width, browser font size, browser zoom level, etc.?
I must admit to being guilty of making this up on the spot
With leniency based on your confession
, your code has two race conditions:
[*:11jpkcyq] Most important: Your script may not be scheduled to run in time to catch a key press during its tiny window. (This just happened to me as I entered "1" to create this list while having your script running; I had several letters of the alphabet scattered among the many 1's which poured into this post.)
[*:11jpkcyq] "1" can sometimes stop the spamming, depending on whether the timer is set or turned off first.