Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 908 Bytes

E13 - FIRST CLASS FUNCTIONS - ft. Anonymous Functions.md

File metadata and controls

52 lines (35 loc) · 908 Bytes

Episode 13: FIRST CLASS FUNCTIONS 🔥ft. Anonymous Functions 🔥

Function Statement or Function Declaration

function a(){
    console.log("a")
}
a();

Function Expression

var b = function (){
    console.log("b");
}
b();

Anonymous Function

function () {

}

Can only be used with function expression. It is unnamed function.

Named Function Expression

var b = function xyz(){
    console.log(xyz);
}

b();

We can also name functions in JS func expressions.

Parameters vs. Arguments

Parameters: Labels/placeholders inside a function.

Arguments: The variables, entities that we pass in a function call.

First Class Functions

Functions are first class citizens in JS. They can be passed as an argument, returned or stored as a value.