Question:

What does the following code print to the console?

function foo () {
  return bar();
  function bar() {
    return "Poppin' bottles";
  }
}
console.log(foo());

Answer:

"Poppin' bottles"

The bar() method is hoisted to the top of the foo() method, so it can be called before it's defined.


Keywords:

© 2017 QuizBucket.org