Output: a function logs global x, then declares var x locally after the log
EasyP1Output
What does this code print?
1var x = 'global';2function show() {3 console.log(x);4 var x = 'local';5 console.log(x);6}7show();8console.log(x);
Saved automatically
One line per console.log. Arrays as [1, 2, 3], objects as { a: 1 }, an uncaught error as Uncaught TypeError: message (Chrome and Node wording).
Hints
Saved automatically