Demystifying JavaScript Variable Scope and Hoisting

The best alternative is to write the code so that the declarations appear at the spot in the code that they will be run so that you don’t need to remember that the declaration gets hoisted because you have written it in that location to start with.