I am having trouble assigning function return value to variable. Why do I get the function returned instead of the final product when I log it to console?
time = ->
today = new Date()
minutes = today.getMinutes()
if minutes < 10 then minutes = "0#{minutes}"
hours = today.getHours()
if hours < 10 then hours = "0#{hours}"
"#{hours}:#{minutes}"
console.log time
Simply add
doto execute the function (if you expect “time” to contain the string, not the function):or use “time” as a function, i.e., invoke it: