Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Advanced JavaScript

You're reading from   Advanced JavaScript Speed up web development with the powerful features and benefits of JavaScript

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher
ISBN-13 9781789800104
Length 330 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Zachary Shute Zachary Shute
Author Profile Icon Zachary Shute
Zachary Shute
Arrow right icon
View More author details
Toc

Summary


JavaScript is an asynchronous, event-driven, single-threaded language. Instead of hanging during a long-running operation to another resource, JavaScript does work on other operations if any work is pending. JavaScript accomplishes this with the event loop. The event loop is composed of the call stack, heap, event queue, and main event loop. These four components work together to schedule when JavaScript runs different parts of the code. To leverage JavaScript's asynchronous nature, we use callbacks or promises. Callbacks are simply functions passed as arguments into other functions. Promises are special classes with event handler functions. When an asynchronous operation finishes, the JavaScript engine runs the callback or calls the promise handler attached to that operation's complete event. This is asynchronous JavaScript in its simplest form.

In the next chapter, we will learn about the Document Object Model (DOM), the JavaScript event object, and the jQuery library.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime