javascript - Cannot read property 'length' of undefined -


$ ->    window.app.helpers = new class helpers      constructor: (@name) ->       @sliderecipeid     = $("#sliderecipe")       @specialities      = ["a", "b", "c"]        settimeout @countuprecipes, 3000      countuprecipes: ->       @sliderecipeid.html(@specialities[math.floor(math.random() * @specialities.length)]) 

the problem on load these errors:

uncaught typeerror: cannot read property 'length' of undefined  

what's wrong code ? thanks.

you need bind context when calling @countuprecipes:

settimeout =>      @countuprecipes , 3000 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -