Amazines Free Article Archive
www.amazines.com - Friday, December 14, 2018
Read about the most recent changes and happenings at Amazines.com
Log into your account or register as a new author. Start submitting your articles right now!
Search our database for articles.
Subscribe to receive articles emailed straight to your email account. You may choose multiple categories.
View our newest articles submitted by our authors.
View our most top rated articles rated by our visitors.
* Please note that this is NOT the ARTICLE manager
Add a new EZINE, or manage your EZINE submission.
Add fresh, free web content to your site such as newest articles, web tools, and quotes with a single piece of code!
Home What's New? Submit/Manage Articles Latest Posts Top Rated Article Search
Google
Subscriptions Manage Ezines
CATEGORIES
 Article Archive
 Advertising (133272)
 Advice (160773)
 Affiliate Programs (34733)
 Art and Culture (73641)
 Automotive (145550)
 Blogs (75006)
 Boating (9841)
 Books (17129)
 Buddhism (4122)
 Business (1328035)
 Business News (426289)
 Business Opportunities (366242)
 Camping (10949)
 Career (72751)
 Christianity (15837)
 Collecting (11636)
 Communication (115049)
 Computers (241940)
 Construction (38970)
 Consumer (49645)
 Cooking (17058)
 Copywriting (6567)
 Crafts (18210)
 Cuisine (7535)
 Current Affairs (20373)
 Dating (45769)
 EBooks (19684)
 E-Commerce (48190)
 Education (185126)
 Electronics (83431)
 Email (6389)
 Entertainment (159786)
 Environment (28928)
 Ezine (3038)
 Ezine Publishing (5443)
 Ezine Sites (1552)
 Family & Parenting (110881)
 Fashion & Cosmetics (196378)
 Female Entrepreneurs (11840)
 Feng Shui (130)
 Finance & Investment (310216)
 Fitness (105822)
 Food & Beverages (62819)
 Free Web Resources (7936)
 Gambling (30211)
 Gardening (25064)
 Government (10517)
 Health (629047)
 Hinduism (2160)
 Hobbies (44026)
 Home Business (91542)
 Home Improvement (251226)
 Home Repair (46099)
 Humor (4805)
 Import - Export (5444)
 Insurance (45093)
 Interior Design (29541)
 International Property (3485)
 Internet (190953)
 Internet Marketing (146282)
 Investment (22822)
 Islam (1168)
 Judaism (1357)
 Law (80450)
 Link Popularity (4592)
 Manufacturing (20809)
 Marketing (98728)
 MLM (14136)
 Motivation (18211)
 Music (26997)
 New to the Internet (9475)
 Non-Profit Organizations (4048)
 Online Shopping (129604)
 Organizing (7797)
 Party Ideas (11854)
 Pets (38083)
 Poetry (2234)
 Press Release (12667)
 Public Speaking (5620)
 Publishing (7522)
 Quotes (2407)
 Real Estate (126602)
 Recreation & Leisure (95239)
 Relationships (87432)
 Research (16153)
 Sales (80293)
 Science & Technology (110125)
 Search Engines (23445)
 Self Improvement (153070)
 Seniors (6221)
 Sexuality (35935)
 Small Business (49277)
 Software (82919)
 Spiritual (23460)
 Sports (116459)
 Tax (7658)
 Telecommuting (34074)
 Travel & Tourism (306921)
 UK Property Investment (3117)
 Video Games (13420)
 Web Traffic (11723)
 Website Design (56784)
 Website Promotion (36556)
 World News (1000+)
 Writing (35758)
Author Spotlight
MOBILE STYLES

Mobile Styles, the leading on-demand Beauty & Health app in the U.S. delivers talented professionals...more
INNES DONALDSON

Offering freelance SEO and content writing services plus much more to businesses across the UK and i...more
INNES DONALDSON

Fresco Creative offer freelance SEO and Online Marketing solutions to businesses large and small acr...more
ROBERT HOWARD

The Word of God is as, “Sweet as Honey”. God has Taken Me Through a Whole Lot of Things...more
ADRIAN JOELE

I have been involved in nutrition and weight management for over 12 years and I like to share my kn...more


What are JavaScript promises? Super high level explanation. by Milecia McG






What are JavaScript promises? Super high level explanation. by
Article Posted: 12/05/2018
Article Views: 69
Articles Written: 14
Word Count: 554
Article Votes: 0
AddThis Social Bookmark Button

What are JavaScript promises? Super high level explanation.


 
Software,Website Design,Advice
Whether you plan on doing anything asynchronously or not, it's a nice little golden nugget to have the knowledge of how to it in JavaScript. An answer to the async problem comes in the form of promises.

JavaScript promises are basically objects that represent the success or failure of some code that's been executed asynchronously. This might not sound like that big of a deal because it's one of those subtle issues that happen in JavaScript.

Using event listeners was one way to watch out for async operations, but there are times the listeners will trigger too early and the event will happen incorrectly. That's where promises come in.

They aren't anything new, they have just been refined. JavaScript promises have been around in some form of API for years. Even jQuery has something comparable called deferreds although they don't work quite the same.

The problem that promises solve is the issue of executing code at the right time after another operation has completed. For example, when you see the loading wheel on a website a bunch of things are happening in the background. There are probably some database calls going on or some calculations being run to determine which content to show on the page.

When all of that background stuff finishes, you'll either see the screen you were waiting for or an error. That's where promises come in. A promise will wait for all of that background stuff to finish with their individual timings and then it will execute the appropriate code.

So after all of the operations have finished, the promise will return a result of either success or failed. Depending on how you want your code to work, you can set up callback functions to handle the success or fail cases. That way you can be sure of what will happen on the screen for a user regardless of what happens on the back-end.

A promise will also catch all of the errors that happen in the chain leading up to a failure which will be useful for debugging. Probably the most notable feature of JavaScript promises you'll hear about is how they are "thenable".

This literally means you can slap the then() method at the end of a promise and run completely new async processes using the results. You can chain as many of them together as you need and they will all run the code asynchronously.

Here's a picture of what promises look like:

As you can see in this example, the promise won't do anything until all of the tasks it's waiting for are done. Then it executes a callback that uses the results of those tasks. Then you can use then() to continue the process using some other tasks.

Whew! Those are JavaScript promises in a nutshell. Unlike some of the other concepts like polymorphism and inheritance, promises are harder to explain without using code but hopefully you have a better high level understanding of how they work, what they are used for, and why we use them.

-----

Alright. It's time you learn even more about JavaScript, especially if you're just starting out. Go download my free JavaScript tutorial here

What do you have to lose? I mean, it's free. Last week 164 people downloaded it so give it a shot.

Related Articles - javascript, web development, beginners, learning to code, async,







Email this Article to a Friend!

Receive Articles like this one direct to your email box!
Subscribe for free today!

 Rate This Article  
Completely useless, should be removed from directory.
Minimal useful information.
Decent and informative.
Great article, very informative and helpful.
A 'Must Read'.

 

Do you Agree or Disagree? Have a Comment? POST IT!

 Reader Opinions 
Submit your comments and they will be posted here.
Make this comment or to the Author only:
Name:
Email:
*Your email will NOT be posted. This is for administrative purposes only.
Comments: *Your Comments WILL be posted to the AUTHOR ONLY if you select PRIVATE and to this PUBLIC PAGE if you select PUBLIC, so write accordingly.
 
Please enter the code in the image:



 Author Login 
LOGIN
Register for Author Account

 

Advertiser Login

 

ADVERTISE HERE NOW!
   Limited Time $60 Offer!
   90  Days-1.5 Million Views  

 

Great Paranormal Romance

World News


STEPHEN BYE

Steve Bye is currently a fiction writer, who published his first novel, ‘Looking Forward Through The...more
LAURA JEEVES

At LeadGenerators, we specialise in content-led Online Marketing Strategies for our clients in the t...more
GENE MYERS

Author of four books and two screenplays; frequent magazine contributor. I have four other books "in...more
SUSAN FRIESEN

Susan Friesen, founder of the award-winning web development and digital marketing firm eVision Media...more
NANETTE VICTORIA

Nanette Victoria Spiritual Coach and Intuitive Guide (over 27 years experience) Spiritual Ministe...more
MICHAEL BRESCIANI

Rev Bresciani is the author of two Christian books. One book is an important and concisely written b...more
JAVIER VBOIX

For the time being just a newbie in the Insurance Industry but a quick learner, soon-to-be expert Ja...more
SANDY FISCHEL

Sandy Fischel is the marketing director at And Above All YOGA, a wholly owned division of The Fische...more
CHRISTOPHER EVANS

Christopher is based in the U.K. and is the author and founder of Critical Eye. ...more
STEVERT MCKENZIE

Stevert Mckenzie, Travel Enthusiast. ...more

HomeLinksAbout UsContact UsTerms of UsePrivacy PolicyFAQResources
Copyright © 2018, All rights reserved.
Some pages may contain portions of text relating to certain topics obtained from wikipedia.org under the GNU FDL license