⬕ 9 JavaScript Function
❒ Every JavaScript developer should know
A Thread 🧵↓
➊ function statement
⇥ 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.
That's all for now.
If you liked this thread, make sure to:
1. Follow me @souravWD
2. Retweet the first tweet
Thank you so much for getting to the end of the thread 💙 ! Let me know what you think below 😊 .
Cheers!
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.