DEV Community

Discussion on: Hoist Your Vars! (Variable Hoisting in JavaScript)

nerdharder615 profile image

While it is important to understand hoisting in JavaScript, it is also a bad practice to use it in general. I suggest that you treat JavaScript just like any other programming language and don't use hoisting.

I have a template that I follow for any script that write:
// Declare variables:

// Declare functions:

// Start of coding:

Having those three sections makes it much easier for me to keep track of what is in my script.

thecodepixi profile image
Emily A. Pixi Author

That is excellent advice and very true!