Tuesday, 4 October 2016

Variable Hoisting Problem in JavaScript

JavaScript by default, hoist all the variable at the top of scope.
This may create unexpected results.

Always declare variable at top of scope in JavaScript.

Check below example.


No comments:

Post a Comment