JSFiddle - React, Tailwind, and code Playground

JavaScript

function Service() {
    var self = this;
    this.data = [];
    setTimeout(function () {
        self.data.push("a");
        self.data.push("b");
        self.data.push("c");
    }, 100);
}

Service.prototype.getData = function () {
    var self = this;
    console.log(self.data);
};

var serv = new Service();

setTimeout(function () {
    console.log(serv.data);
}, 200);