← Back to Question List
JavaScript Code Walkthrough #44
var Hoisting Inside a Function
📄 Code
Read carefully — what does this print?1var x = 1;2function f() {3 console.log(x);4 var x = 2;5 console.log(x);6}7f();8console.log(x);