---
title: "Discussion on \"Callback Functions,  Event Listeners, and Event Loop in JavaScript.\" | Hashnode"
description: "Discussion on \"Callback Functions,  Event Listeners, and Event Loop in JavaScript.\". How is Event Loop responsible for asynchronous programming in JS?"
url: "https://hashnode.com/posts/callback-functions-event-listeners-and-event-loop-in-javascript/60a4c2bd59b7dc409c3d2cab"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Callback Functions, Event Listeners, and Event Loop in JavaScript.](https://deepkiran.hashnode.dev/callback-functions-event-listeners-and-event-loop-in-javascript?utm_source=hashnode&utm_medium=feed)

How is Event Loop responsible for asynchronous programming in JS?

May 19, 2021 · 6 min read · deepkiran.hashnode.dev  
Read the article

-   [#event-loop](https://hashnode.com/tag/event-loop)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#functions](https://hashnode.com/tag/functions)
-   [#events](https://hashnode.com/tag/events)
-   [#message-queue](https://hashnode.com/tag/message-queue)

## Written by

[Deep Kiran](https://hashnode.com/@DeepKiran)

@DeepKiran

  
[View profile](https://hashnode.com/@DeepKiran)

I love to develop web apps

## Responses 1

Markdown supported · ⌘↵ to post

[Piyush Garg](https://hashnode.com/@piyushgarg)

[May 19, 2021](https://hashnode.com/posts/callback-functions-event-listeners-and-event-loop-in-javascript/60a4c2bd59b7dc409c3d2cab/comment/60a5029b5c1fcb40773650f2)

Woahh! 🚀 Great example!

```
setTimeout(function(){
    console.log("Print this after 2 seconds");
},2000);
function X(Y)
{
    console.log("I am X");
    Y();
}
X(function Y()
{
    console.log("I am Y");
})
```

[Deep Kiran](https://hashnode.com/@DeepKiran)

[May 19, 2021](https://hashnode.com/posts/callback-functions-event-listeners-and-event-loop-in-javascript/60a4c2bd59b7dc409c3d2cab/comment/60a5029b5c1fcb40773650f2#reply-60a50d7659b7dc409c3d39b3)

Thanks man :)
