```js
var type = e.which  == 37 ? 'prev' :
                e.which == 38 ? 'first' :
                e.which == 39 ? 'next' :
                e.which == 40 ? 'last' : null
```