class SocialStudies
constructor : (@val1,@val2) ->
console.log 'constructed '+@val1+' | '+@val2
doAlerts :
firstAlert : =>
alert @val1
secondAlert : =>
alert @val2
secondPeriod = new SocialStudies 'git to class!', 'no recess for you!'
secondPeriod.doAlerts.firstAlert() // error this.val1 is not defined
Hopefully you get the idea. I would like to access @val1 from a method set inside a method, and fat arrow does nothing! Does anyone know what to do here?
1 Answer