If you are a newbie to programming and JavaScript, you might first find it hard to grasp the concept of functions.
When I first learned about fun...
For further actions, you may consider blocking this person and/or reporting abuse
If you wrote a book about learning javascript as detailed and well explained as the above...you will have a best seller. Javascript books , especially for beginners need to be explained as you have done. Perfect.
Thank you so much for your kind words! Comments like this really boost my motivation! ❤️
Regarding function expressions, you've omitted to mention that you can name functions defined in this manner - and in fact it can be a good idea to do so. If they are not named they will show up as 'anonymous' functions in stack traces. So, it is equally valid to write:
In this case, stack traces involving the function will show the name
calculateAge
instead of 'anonymous function'I don't disagree with your premise in the least - I prefer explicitly named functions as well.
However introduced with ES2015:
Thank you so much for correcting that, Jon! I will add that part.
Just wanted to show the difference as basics without confusing the newbies, because I was not touching other function types in this article. 😂
Does the Arrow Function way really work in this case? I copied and pasted the code to run and set the birthyear to 2020, it still says 'eligible'.
I noticed there is a 'eligibleToDrive' and also a 'EligibleToDrive'. Only the first letter is different, but never seen where to use 'EligibleToDrive'.
Hi Raymond, sorry for the confusion and there was an error. And thank you for pointing it out. And I corrected it and added a new code.
Sumudu. It works now. Thank you for the correction.
I've actually read quite a few articles about JavaScript functions, but I must say that this one is by far the best at explaining them. Now I feel like I have a much better understanding of functions. Thank u so much
I just wanted to say thank you so much for writing this article because I have so much better understanding of functions than I did now. Thank you so much for breaking this down.
I had so much trouble in understanding how they worked but this actually clicked for me. Please keep writing these.
Me lo leí todo 😊 buen aporte!! Thanks
Great read. Loved every word of it💯🧡
Thank you, Shubhra!
OMG! I did that, and it worked! Thank you so much!!!!
Nice and Amazing Post. You should also start a newsletter :-D
Keep it up I like this Dua to make man love you and have eyes on you
I will be sharing with my students, great article!
Thank you 😊
Simply the clearest explainations to understand JS functions basic concepts I ever read , as a beginner I never clearly understund the difference between arguments and parameters..until now !
Thank you for writing this article !
Thank you so much for taking the time to read and for you feedback!
1 more function check my post 😁😁
This is clearest approach ever,Thank you Sumudu.
I'm glad you liked it. Thank you!
Excellent explanation! But... (though I I resolved by myself, :))) it's me the only one who don't sees the "elegible to drive" code? I see "Years to retirement" code instead.
Thanks so so so much.
Hi Miq, I have change the paragraph and code due to some errors. Can't you still see the changes? I cannot see any diference.
Hi Sumudu! Now everything seems correct. Thanks for your work.
Very good breakdown of functions, bookmarked!
~Could I request your next article to be on state management in React? 🚀
Thank you! I'm still learning JS and haven't done React yet 😞
You have explained it in a very simple way that can be understood ezsily.
Thanks!!
I'm glad to hear that. Thank you for taking the time to read it.
Hey, i need help. I accidently ran a command chmod 777 - r on OS file system. Root User disabled and website got database error. How to fix this? URGENT!!
Awesome article Sumudu, thanks for putting this together
Thank you so much for your kind words, Lucian!
Nice you can also write about anonymous functions specially the ones self invoking ypu dont even have to name them
Yes, Will be having a different article on these areas 😊
This was just the right speed and detail. Now, I feel like I get it at this moment in time. Thanks so much!