Peter V Peter V - 1 year ago 95
CoffeeScript Question

call a function with no arguments in CoffeeScript

How do I call a function with no arguments in CoffeeScript without parens?

fun = -> alert "Boo!"


I have tried
fun.
and
(fun)

Answer Source
fun = -> alert "Boo!"
do fun

It is shorthand syntax for calling functions that are declared in-place.

someVar = do -> #some code...