Question: I need to customize my QTabWidget so that one of its tab bars (lets say there are 4 tabs overall) has expanding property and will fill the remaining space between other tabs. Any ideas?

Answer: 
You can also define a reusable function, utilizing `setInterval` and `clearInterval`

```
function runFunctionXTimes(callback, interval, repeatTimes) {
    let repeated = 0;
    const intervalTask = setInterval(doTask, interval)

    function doTask() {
        if ( repeated < repeatTimes ) {
            callback()
            repeated += 1
        } else {
            clearInterval(intervalTask)
        }
    }
} 

function sayHi() {
    console.log("Hi")
}

```

The following line will run `sayHi` 5 times without wasting any time between completion of one and the beginning of another.

```
runFunctionXTimes(sayHi, 0, 5)

```

It is also possible to pass function arguments to `setInerval`, you can read more about it here <https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval>
Using recursion:

```
function repeat(fn, times) {
  var loop = function (times) {
    if (times) {
      fn(times);
      loop(--times);
    }
  }
  loop(times);
}

repeat(function (times) {
  console.log(times);
}, 5);

```