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
Post a Comment