You want to hide a dom element when some key triggers “keyup”. This is a fairly simple scenario where your code just might end up looking like this. So what is the problem? The problem is that closeDialog() has two very clear and very different responsibilities. 1. Determine what key triggered the “keyup” event 2. […]