Hey Lërnër,
the while loop is part of my explanation why the for loop using let behaves the way it does.
There are many people (including me) that are surprised when they find out that the let of the for loop behaves like it is declared within the block of the for loop and not in the same block that the whole for loop belongs to.
If that is already clear to you, you can just ignore that part.
One additional remark is that the examples in the article also work if they are not in the global scope. So it has nothing to do with i being in the global scope. setTimeout captures the value of it in a closure.