๐ Day 2๏ธโฃ3๏ธโฃ / 3๏ธโฃ0๏ธโฃ days of basics in JavaScript series!
โ What is a function declaration?
โ What is a function statement?
โ What is function expression?
โ Difference between function declaration & function expression?
โ What is an anonymous function?
#javascript30
๐งตโฉ
๐ What is a function declaration?
โ A function declaration always starts with the "function" keyword.
โ The function declaration must have a function name.
๐ What is a function statement?
โ The function statement is the synonym of the function declaration.
โ Both are the same.
๐ What is function expression?
โ This is also a function but without a function name.
โ A function expression can be stored in a variable using the (=) assignment operator.
โ The function can be assigned in a variable as a value using the (=) assignment operator.
โ And they are always called(invoke / run) using the name of the variable.
โ Here "squares" is the name of the variable.
๐ Difference between function declaration & function expression?
โ The main difference is that function declaration is hoisted but not function expression.
โ We can call/invoke the function declaration "after" and "before" the function definition.
โ But function expression can only invoke/run/call "after" the function definition.
โ If we call the function expression before initialization, then this will give an error.
๐ What is an anonymous function?
โ A function without a name is called an anonymous function.
๐ That's all for now, we will meet in the next thread!
But if you like make sure to:
1. Follow me @ATechAjay
2. Retweet the first tweet.
3. Turn on the notification to never miss these amazing tweets.
Thank you so much for staying to the end of this thread.
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.