JSFiddle - React, Tailwind, and code Playground

by fableal

HTML

<html>
    <body>
    </body>
</html>

JavaScript

$(function(){
    
    Number.prototype.repeat = function(doSomething){
        var last = Math.floor(this);
        var ret = new Array(last);
        for(var i = 0; i < last; ++i){
            ret[i] = doSomething();
        }
        return ret;
    };
    
    // Example:
    (5).repeat((function(){
        var i = 0;
        return function(){
            ++i;
            $('body').append(i).append('<br />');
            return i;
        };
    })());

});