Reputation: 206
I'm trying to put a function within an object in CoffeeScript however when printing the function I get the actual function and not what I've asked it to return.
I am currently learning CoffeeScript so please excuse me if this is a really silly mistake :)
Here is my code:
define =
hello: ->
Swordling = true
user = "Swordling" if Swordling
return user
alert define.hello
And here is the result I get: http://prntscr.com/8wzi6f
Upvotes: 0
Views: 337
Reputation: 522016
Well, yes, you're only outputting the function, you're not calling the function:
alert define.hello()
Upvotes: 1