Ajax Loader
×

Javascript Variable Hoisting Explained

Javascript Hoisting is an interesting as well as an important concept to get ourselves acquainted with. If not, then we can fall into troubles from time to time, pulling out hairs to debug and fix weird bugs!

In a gist, what basically happens is that, all the variable declarations from variable definitions (with var keyword) inside a function get's hoisted/raised to the top of the function.

Note: Only the variable declaration gets hoisted, not the variable initialization!

Related:


    Warning: Invalid argument supplied for foreach() in /var/www/cssdeck/app/modules/labs/views/_details.php on line 68
×

Coding Preferences


HTML

CSS

Javascript

More

×

Your Default Settings - Preferences

×
×
×

Validations

(Errors from your JS or Pre-Processors code)

    HTML
    CSS
    JavaScript

    Javascript Variable Hoisting Explained

    CSSDeck G+