Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Lesson 23: Function expressions vs declarations

Two ways to define functions, with different hoisting.

What you'll learn

  • declaration: function f() {} — hoisted, callable before definition
  • expression: const f = function () {} — not hoisted
  • named expressions help stack traces
  • IIFE: (function () { ... })() runs immediately

Example

See examples/.

Exercise

Show a case where hoisting differences matter.