hello i'm new to javascripting and coffee script but I just want help how to shorten this line in javascript so I can make changes to it later to simplify it in coffeescript

coffescript

keyDownHandler = (event) ->
selectedItem = $(event.target).siblings(".suggestions").children(".current-suggestion")
if selectedItem.length > 0
if event.which is 40
nextItem = $(selectedItem).removeClass("current-suggestion").next()
nextItem.addClass "current-suggestion" if nextItem.length > 0
return
if event.which is 38
nextItem = $(selectedItem).removeClass("current-suggestion").prev()
nextItem.addClass "current-suggestion" if nextItem.length > 0
return
if event.which is 13 or event.which is 9
addSuggestion(event.target)(selectedItem)
event.preventDefault()
return

javascript

var keyDownHandler, nextItem;
keyDownHandler = function(event) {
var selectedItem;
return selectedItem = $(event.target).siblings(".suggestions").children(".current-suggestion");
};
if (selectedItem.length > 0) {
if (event.which === 40) {
nextItem = $(selectedItem).removeClass("current-suggestion").next();
if (nextItem.length > 0) {
nextItem.addClass("current-suggestion");
}
return;
}
if (event.which === 38) {
nextItem = $(selectedItem).removeClass("current-suggestion").prev();
if (nextItem.length > 0) {
nextItem.addClass("current-suggestion");
}
return;
}
if (event.which === 13 || event.which === 9) {
addSuggestion(event.target)(selectedItem);
event.preventDefault();
return;
}
}