Function declarations are hoisted. It means, we can use the function before we declare it
hoisted(); // logs "foo"

function hoisted() {
  console.log('foo');
}
Function expressions - anonymous functions are not hoisted:
notHoisted(); // TypeError: notHoisted is not a function

var notHoisted = function() {
   console.log('bar');
};
by Valeri Tandilashvili
4 years ago
JavaScript
Function hoisting
2
Pro tip: use ```triple backticks around text``` to write in code fences