Hoisting and Execution Context

How does function hoisting allow code execution before declaration?
function foo() {
  return bar();
  function bar() {
    return 'Hello!';
  }
}

console.log(foo());
Next Question (6/20)