I'm having issues with the window.setInterval() method. Below is an example of the structure, the method "repeat" is called repeatedly, however I cannot call any methods inside "repeat". In the example when I instantiate manager (let m = new manager()) it will print "Before Print", but will not print out the log from the printStuff method, or the "After Print" message.
Does anyone know why this is happening? Obviously this isn't my actual code as it's simple enough to not be in separate functions, however my actual code needs to call many functions in the "repeat" function and it will stop execution when it finds a call to another function.
class manager{
constructor(){
window.setInterval(this.repeat, 5000);
}
repeat(){
console.log("Before Print");
this.printStuff();
console.log("After Print");
}
printStuff(){
console.log("Print Stuff");
}