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: 
You can create Timeout function and use it with `async`/`await`

```js
// Timeout function
const timeout = (ms) => new Promise(resolve => setTimeout(resolve, ms));

// Run some loop in async function
(async () => {
  // Loop for 5 times
  for(let i = 0; i <= 5; i++) {
    // Do some stuff
    console.log(`Some stuff ${i}`);
    // Wait for timeout 1000 ms
    await timeout(1000);
  }
})();
```
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