Question: I have read the relevant pages on w3schools and other similar questions here but cannot seem to understand what's wrong about the following bit :

```
var myfunc03 = function (i) {
  document.getElementById('d01').innerHTML += 100-i+"<br>";
};

var myFunc01 = function() {
  i=0;
  while (i<100) {
    setTimeout(myfunc03(i), 1000)
    i++;
  }
};

```

when `myFunc01();` is run.

There's no pause whatsoever and all possible values for i is listed at once.

Is there a logical mistake here?

Answer: 
Yes. There are 2 problems in your code:

1. The [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout) function accept a function as the first argument, but in your code, `myfunc03(i)` returns nothing
2. The while loop won't meet you needs, instead, you have to use recursive function. Since the second function should be invoked after the first timeout is fired.

Sample code:

```js
var myfunc03 = function (i) {
  setTimeout(function() {
    document.getElementById('d01').innerHTML += 100-i+"<br>";
    if (i < 100) {
      i++;
      myfunc03(i);
    }
  }, 1000);
};

var myFunc01 = function() {
  myfunc03(0);
};

myFunc01();
```

```html
<div id="d01"></div>
```
the while method runs quickly and all timeout almost gets executed after first second.. what you can do is

1. Instead of while call `$timeout` from `myfunc03` for next value
2. inside your while call timeout with increasing seconds like `i*1000`

Also, as others pointed out you can't call functions with params like that from `setTimeout`
use anonymous function like

```
...
while (i<100) {
  setTimeout(
     function(i){
        myfunc03(i);
     }, i*1000);
   i++;
}
...

```

for that