TEDSF Interview Skills Q&A Platform
1 like 0 dislike
12 views
What is event loop? What is the difference between call stack and task queue?
in Web Development by Platinum (104k points) | 12 views

1 Answer

0 like 0 dislike
Best answer

CallStack is a data structure which keeps track of function calls in our program. When ever we call a function for its execution, we are pushing it to the stack. It is popped out of the stack when the execution is completed.

Task Queue (Micro task Queue) is a JavaScript runtime messaging queue which handles task that is allocated by different Web Apis. This queue is dedicated to handle the Web Apis callbacks. The message are processed once the call stack is clear.

Event Loop has pretty specific work. It has responsibility to see weather the call-stack is empty and does the task queue contains pending task to process. If the call-stack is empty, it will push the task to the call-stack from the queue and the task gets processed.

by Platinum (104k points)
Welcome to TEDSF Skills Questions and Answers, a platform, where you can ask skills questions and receive answers from other members of the community. On TEDSF the youth, students, teachers, policy makers and enthusiasts can ask and answer any questions. Get help and answers to any skills-related problem including mathematics, computer science, data science, web development, physics, chemistry, digital marketing, African development and more. Help is always 100% free!

4.1k questions

1.4k answers

64 comments

29.6k users

4,058 questions
1,448 answers
64 comments
29,583 users