5 ms·
See this answer: http://news.ycombinator.com/item?id=5269731 http://news.ycombinator.com/item?id=5269731 In the second, the var myFunction gets hoisted to the
by jtdaugh 14y ago
See this answer: http://news.ycombinator.com/item?id=5269731 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.