---
title: "Comment by Piyush Garg on \"Callback Functions,  Event Listeners, and Event Loop in JavaScript.\" | Hashnode"
description: "Woahh! 🚀 Great example! setTimeout ( function ( ) { console .log( &quot;Print this after 2 seconds&quot; ); }, 2000 ); function X ( Y ) { console .log( &quot;I"
url: "https://hashnode.com/posts/callback-functions-event-listeners-and-event-loop-in-javascript/60a4c2bd59b7dc409c3d2cab/comment/60a5029b5c1fcb40773650f2"
---

[Discussion](https://hashnode.com/posts/callback-functions-event-listeners-and-event-loop-in-javascript/60a4c2bd59b7dc409c3d2cab)

Comment [Callback Functions, Event Listeners, and Event Loop in JavaScript.](https://hashnode.com/posts/callback-functions-event-listeners-and-event-loop-in-javascript/60a4c2bd59b7dc409c3d2cab)

[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 :)
