I have some javascript code that needs to run every 6 seconds that looks like this:
this.y = function()
{
//some logic that may or may not call y_a or y_b
this.y_a = function()
{
//some logic
}
this.y_b = function()
{
//some logic
}
var self = this;
setTimeout(function(){ self.y(); }, 6000);
}
y_a and y_b are not needed outside the scope of y.
As this function is being called every 6 seconds, is it significantly inefficient to keep redeclaring y_a and y_b? Or should I define them once outside the scope of y?