I have some class with some functions and properties
exports.textareaWidget = class textareaWidget extends Widget
name = null
getHtml: ->
this.generateHtml(widgetHtml)
Then I create an object and add to array:
obj = new w.textareaWidget()
obj.name = "msgBody"
console.log obj.getHtml() # works
arr.push(obj)
# getting from arr
for field in arr
result = result + field.getHtml()
When I want to get it from array I can access properites (name) but I can't access functions (getHtml). Why and how can I make it working ? The error:
TypeError: Object #<Object> has no method 'getHtml'
When I want to get it from arraycan we see that code portion?name = nullandgetHtml: ->. Like this, these statements are not part of the class definition!