nuno-m
1/23/2018 - 12:25 PM

Define function

Diferent ways to define a function in javascipt

//function declaration
function myFunction() {
  statements
}

//function expression 
var myFunction = function() {
    statements
}

//named function expression
var myFunction = function namedFunction(){
    statements
}

//IIFE (Immediately Invokable Function Expression)
(function() {
    statements
})();