Comment on Common JavaScript GotchasparentComments−jtdaugh13ySee this answer: http://news.ycombinator.com/item?id=5269731In the second, the var myFunction gets hoisted to the top but not the function definition, which is why calling it produces an error. In the first, the whole function gets hoisted to the top.
Comments
See this answer: http://news.ycombinator.com/item?id=5269731
In the second, the var myFunction gets hoisted to the top but not the function definition, which is why calling it produces an error. In the first, the whole function gets hoisted to the top.