The output of this code will be:

'undefined' 123

This is because the variable 'num' is being used before it is declared and assigned a value. When the first line of code runs, 'num' is undefined, so the output is simply 'undefined'. Then, the variable is declared and assigned a value of 123, and the second line of code outputs that value.

JavaScript Variable Hoisting: Understanding 'undefined' Output

原文地址: https://www.cveoy.top/t/topic/ozrw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录