What is the difference between using a let in the body of the for loop and a var specifically in the body of a JavaScript for loop? Do they work differently and why?
Example:
Using let
for (let i = 0; i < 10; i++) {
}
Using var
for (var i = 0; i < 10; i++) {
}
Do these work the same way or differently behind the scenes, does one actually functions better?
Does this difference apply to a while loop and a do-while loop too?