β₯ when we create a new function with FUNCTION keyword, we all it function statement.
β₯ example:
β function expression
β₯ creating and assigning a function to a variable is known as function expression.
β₯ example:
β function declaration
β₯ creating a new function is known as function declaration. we can declare a function in both way, function expression
example:
β function invocation
β₯ A defined function can be invoked with () at the end of function name. in the below code snippet, at line no.5, we're invoking/calling printUserName function.
β₯ example:
β Anonymous function
β₯ A javascript function without name is called as anonymous function. we can use these function where we using function as value or callback.
β₯ example:
β named function expression
β first class function
β₯ the ability of function
*to be used as values,
*can be passed as an argument to another function and
*can be returned from function
β arrow function
β₯ also known as fat arrow function
β₯ syntax:
β₯ doesn't have its own context
β₯ this inside arrow function will refer to parent's context
β function parameters and arguments
β¬ parameters:
β₯ when we all the function with some values, then those values is known as parameter of the function.
β¬ arguments:
β₯ passed parameters to a function is are argument for the function.