DEV Community

Cover image for What will the console log in this example?
chandra penugonda
chandra penugonda

Posted on • Updated on

What will the console log in this example?

What will the console log in this example?

var foo = 1
var foobar = function() {
  console.log(foo)
  var foo = 2
}
foobar()
Enter fullscreen mode Exit fullscreen mode

Output

undefined
Enter fullscreen mode Exit fullscreen mode

Top comments (0)