JSFiddle - React, Tailwind, and code Playground

by barts2108

JavaScript

var counter = 5;

function makeRequst(options, i) {
    // do your request here
}

function myFunction() {
    alert(counter);
 
    // create options object here
    //var options = {
    //    host:'www.host.com',
    //    path:'/path/'+counter
    //};
    //makeRequest(options, counter);
    
    counter--;
    if (counter > 0) {
        setTimeout(myFunction, 1000);    
    }
}

myFunction();