javascript - How to resolve 'TypeError: Property '_onTimeout' of object #<Object> is not a function' in node? -


the following snipped of code:

var theadnets = new array();  function populateadnetlist() {   }  //update list every 5 minutes. setinterval("populateadnetlist()",300000); //fetch in 5 seconds. settimeout("populateadnetlist();",5000); 

produces following error:

typeerror: property '_ontimeout' of object #<object> not function     @ timer.callback (timers.js:83:39) 

the populateadnetlist() function , not object. there no reference 'this' in body of function() { }. why happening?

that scope issue. if function defined locally in function or object, it's not available in global scope string evaluated.

move function global scope, or use function reference in calls instead avoid scope problem:

//update list every 5 minutes. setinterval(populateadnetlist,300000); //fetch in 5 seconds. settimeout(populateadnetlist,5000); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -