JavaScript Functions Quickly Explained - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Tuesday, August 14, 2018

JavaScript Functions Quickly Explained

A function is a recipe. You make a function which does a few tasks. Then each time you call that function, it will execute these tasks.How do you a make a lemonade?You pour water in a glassThen mix 2–3 spoons of sugarSqueeze 1–2 slices of lemonStir it with the spoon for a minuteAnd you have it!Now when you want me to make a lemonade for you, what do you say?Do you tell me all the steps above again?You pour water in a glass..…Or assume I already know the steps, you just tell me to make a lemonade.That's it!In JavaScript or any other programming language, a function is like a recipe of certain tasks.This makes the life of a programmer much more easier.In JS we define a function like this:function makeLemonade() { let lemonade = 2 sugar + 2 lemon; return lemonade;}And the next time I need a lemonade, I just call the function like this:makeLemonade();Obviously, it's just a made up function, and don't just type it into your computer and wonder, why it's not working. It's just to illustrate the concept.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

es6,javascript,functional-programming,programming

No comments:

Post a Comment