tag:blogger.com,1999:blog-581197352358126527.post5830922799358001927..comments2024-03-28T00:32:25.959-07:00Comments on japh(r) by Chris Strom: Still SwitchAnonymoushttp://www.blogger.com/profile/00135361916531185929noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-581197352358126527.post-85729313577183176132012-05-26T07:45:00.938-07:002012-05-26T07:45:00.938-07:00Good point.
I actually spent a good deal of tim...Good point. <br /><br />I actually spent a good deal of time trying to get that working. I'm a bit annoyed that hash literals can't have integers for keys. Also, I got obsessed with only instantiating the hash once. In the harsh light of day that's premature optimization at it's finest.<br /><br />In the end that's much better than my silly indirection solution. Thanks!Anonymoushttps://www.blogger.com/profile/00135361916531185929noreply@blogger.comtag:blogger.com,1999:blog-581197352358126527.post-44893727766903556982012-05-26T01:21:11.964-07:002012-05-26T01:21:11.964-07:00You can use some magic for Map ;)
var direction ...You can use some magic for Map ;) <br /><br />var direction = {<br /> '37': 'left',<br /> '38': 'up',<br /> '39': 'right',<br /> '40': 'down'<br />}[event.keyCode.toString()];Yehor Lvivskihttps://www.blogger.com/profile/05175949108373981692noreply@blogger.com