UrbanPro

Learn Java Script Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What's the event loop?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

For event loop: /* Within main.js */ var firstFunction=function () { console.log("I'm first!"); }; var secondFunction=function () { setTimeout(firstFunction, 5000); console.log("I'm second!"); }; secondFunction(); /* Results: * => I'm second! * (And 5 seconds later) * => I'm first! ...
read more
For event loop: /* Within main.js */ var firstFunction=function () { console.log("I'm first!"); }; var secondFunction=function () { setTimeout(firstFunction, 5000); console.log("I'm second!"); }; secondFunction(); /* Results: * => I'm second! * (And 5 seconds later) * => I'm first! */ 1. After secondFunction is placed on the call stack, the setTimeout function is invoked and also placed on the call stack 2. Right after the set Timeout function is executed, something special happens here are the browser places set Timeout callback function (in this case, first Function) into an Event Table. Think of the event table as a registration booth: the call stack tells the event table to register a particular function to be executed only when a specific event happens. And when the event does happen, the event table will simply move the function over to the Event Queue. The beauty of this event queue is that its simply a staging area for functions waiting to be invoked and moved over to the call stack. 3. Executing the set Timeout function moves the callback function (in this case, first Function) to the event table and registers it to with a time delay of 5 seconds. 4. Once first Function has completed its execution, we return to a state where there's nothing in the call stack, the event table doesn't have any events to listen for, and the event queue is empty. read less
Comments

PHP Trainer 5 years

Event loop is a criteria by which you can link a event with calling back a function again. Simpley your time table after eating there is a call back function which makes you sleep. Just for example in node js it is simply same but as it is single threaded that means only a single process can be available...
read more
Event loop is a criteria by which you can link a event with calling back a function again. Simpley your time table after eating there is a call back function which makes you sleep. Just for example in node js it is simply same but as it is single threaded that means only a single process can be available in ghe program to handle the callback no other function can access the resources. read less
Comments

Java Trainer

The Event Loop is a queue of callback functions. When an async function executes, the callback function is pushed into the queue. The JavaScript engine doesn't start processing the event loop until the code after an async function has executed.
Comments

Expert in Web Design and development

The Event Loop is a queue of callback functions. When an async function executes, the callback function is pushed into the queue. The JavaScript engine doesn't start processing the event loop until the code after an async function has executed.
Comments

In computer science, the event loop is a programming construct that waits for and dispatches events or messages in a program. It works by making a request to some internal or external "event provider". When the event loop forms the central control flow construct of a program, as it often does, it may...
read more
In computer science, the event loop is a programming construct that waits for and dispatches events or messages in a program. It works by making a request to some internal or external "event provider". When the event loop forms the central control flow construct of a program, as it often does, it may be termed the main loop or main event loop read less
Comments

View 3 more Answers

Related Questions

How to learn Javascript?
I would say, https://developer.mozilla.org/en-US/docs/Learn/JavaScript is the best place to learn if you want real good knowledge in Javascript. Have a little bit patience and put some effort in learning...
Ramya
What is the best way to learn JavaScript?
Three resources I would suggest to have handy while learning JS are: 1. JavaScript MDN 2. You Don't Know JS Book Series 3. javascript.info
Umamahesh
0 0
5
How Java is different from Java script?
Java is server side language is used to make application. Java is need to compile. The end user can not see the code of java it is secured. But Javascript is script language is a open source can be viewed by end user in browser.
Samadhan
How to start Learning Javascript, Jquery and Angular
HI Sandeep..to learn javascript, jquery and angularjs you should be familiar in html, css
Sandeep

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Java Interview Questions & Answers
Java Interview Questions have been designed especially to get you acquainted with the nature of questions you may encounter during your interview for the subject of Java Programming Language. As per my...

JavaScript Arrow Function.
Javascript Arrow Functions : JavaScript ES6 is a type or version which let us provide a way to write javascript syntax on a better way. ES6 version is having a feature or new method to use functions...

What is hoisting in Javascript?
As a matter of fact it is, javascript is an interpreted language and the javascript interpreter performs a lot of mystical stuff behind the scenes. Hoisting in JavaScript is certainly one of them. A quick...

String Comparison In Javascript
String Comparison in javascript: Let us learn how two strings are compared in javascript Assume you have two strings: "ant" and "ele" Case 1: alert("ant" < "ele" ); will give the result as true...
G

Recommended Articles

Here are the top 6 must have skills for every Web Designer : Technical Skills Web designers undoubtedly require very strong technical skills. They must have hands on using Web designing software and tools, such as Adobe Dreamweaver, Fireworks, Photoshop, Flash etc. In addition to the knowledge of design...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Looking for Java Script Training classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Java Script Training Classes?

The best tutors for Java Script Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Java Script Training with the Best Tutors

The best Tutors for Java Script Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more