Docs

Namaste JavaScript — Interview Quick Notes

Ep 13: First Class Functions


  • First-class functions: functions can be passed as arguments and returned from other functions.
  • Function Statement: function a() {} — hoisted fully.
  • Function Expression: var b = function() {} — hoisted as undefined.
  • Named Function Expression: var b = function xyz() {} — xyz not in global scope.
  • Anonymous Function: no name; used as a value; standalone → SyntaxError.
  • Hoisting difference: calling a function statement before declaration works; calling a function expression before declaration → TypeError.