Hoisting is the mechanism in JavaScript where variables are moved to the top of the script and then run. This is because, JavaScript doesn’t have lexical scoping.
This is how JavaScript sees your declaration.
The difference is that the function testOne didn’t get hoisted because it was a variable declaration. Variable “i” gets its declaration hoisted and assigned.
It’s ideal to declare your variables at the top of your function and declare your function next.