Different Ways To Declare Function in JS

 

This is a collection of learnings from Wes Bos course.👌

 

Regular Function

 

Anon or Anonymous Function

Function without a name.

 

Function Expression

Function in a variable name.

 

Hoisting

Any function declaration can run before it’s define.

 

Arrow Function

 

Return an object

 

IIFE - Immediately Invoked Function Expression

In JS parenthesis runs first by putting parenthesis in the end.

 

Methods!!! is simply a function that lives inside of an object

 

Callback Functions