This code gives me error:
TypeError: oneTime is not a function oneTime();
$ ->
value = $("#car_addition_price_type").val()
if value == "one_time"
oneTime()
else if value == "by_day"
byDay()
else
hideAll()
hideAll = ->
$('#by_day').hide()
$('#by_day input').val('')
$('#max_price').hide()
$('#max_price').val('')
byDay = ->
$("label[for='car_addition_price']").text("Cena/dzień")
$('#max_price').show()
$('#by_day').show()
oneTime = ->
$('#by_day').show()
$("label[for='car_addition_price']").text("Cena jednorazowa")
$('#max_price').hide()
$('#max_price input').val('')
Question is simple. Why?
oneTime = ->is converted to a function expression, thevar oneTimegets hoisted (of course) but the assignment stays where it is.