Hello. I create a class with 2 properties, create an instance of the class, but 2nd is returned at "undefined". Why?
class Beer constructor: (@name, @type) ->
myBeer = new Beer ("Epiphany", "DIPA")
print myBeer.name (returns "Epiphany")print myBeer.type (returns "UNDEFINED")
Thx in advance, I'm new to classes!
So if I made that change as you suggested, would I still pass the arguments like:
What was confusing me, was if I used 1 parameter as:
class Beer constructor: (@name)->
it worked fine. As soon as I added the 2nd param (@name, @type) it failed