JSFiddle - React, Tailwind, and code Playground

by ktstowell

JavaScript

var dos = []

var Do = function() {
    this.doing(this.done);
    return this;
};

Do.prototype.doing = function(fn) {
    this.a = 0;
    
    for(var i=0; i<10000; i++) {
        this.a+=i;
    }
    
    console.log(this);
    fn();// execute callback
};

Do.prototype.done = function() {
    console.log('done!', this, Do.a);
};

new Do();