Hello all. It's the weekend and the brain is a bit tired. Can you help clear something up for me?
Created a class with custom properties:
class Beer Constructor: -> @type = "IPA" @price = 5myBeer = new Beer print myBeer.type
This returns "IPA" as desired.
If I remove the "@" symbol before each property it returns UNDEFINED.
Why? Also is this the correct way to create a custom class with custom properties?
Thx in advance!
Yes it is. The @ stands for "this" which (in this context) means "this instance".
Sweet thx. Like I said brain is fried . Time to create an instance of Beer in my house!