JSFiddle - React, Tailwind, and code Playground

JavaScript

var example = function(){
    this.animate = function(){
        alert("Animate.");
    }
    var self = this; // this creates a closure
    this.updateTimer = function(){ // This is being called...
        this.timer = setInterval(function(){
            // this here means window element.
            self.animate(); 
        }, 1);
    }
}

new example().updateTimer();