1. Function Declaration and Invocation:

2. Function Parameters and Arguments:

3. Anonymous Functions:

Arrow Functions:

Closure

A closure is formed when a function is defined within another function.

function outerFunction() {
    let outerVariable = 'I am from the outer function';
  
    function innerFunction() {
      console.log(outerVariable);
    }
  
    return innerFunction;
}
let closureExample = outerFunction();
closureExample(); // I am from the outer function