{"id":86014,"date":"2017-06-10T10:19:20","date_gmt":"2017-06-10T10:19:20","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=86014"},"modified":"2017-06-10T10:19:20","modified_gmt":"2017-06-10T10:19:20","slug":"event-loop-javascript","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/event-loop-javascript\/","title":{"rendered":"Event Loop In JavaScript"},"content":{"rendered":"<p>As a web developer we have knowledge about the JavaScript because in modern era almost all the dynamic websites use JavaScript for better user interface. But due to complex design it&#8217;s a bit difficult to understand the execution process. Event Loop is a most popular process in JavaScript but it is not easy to understand the working process of this.<\/p>\n<p>Today I want to share my knowledge about Event Loop in JavaScript and I hope this blog help you to understand the Event Loop process in JavaScript.<\/p>\n<p>As we know JavaScript runs code step by step means second line code execute just after finish the first line code. JavaScript always adds each line of code in a call stack.<\/p>\n<p>Call stack is like a shopping bag like first item that enters into the shopping bag is the last item to goes out from the shopping bag and vice versa. We can also say call stack is like a Data Structure that defines and identifies our position in the program.<\/p>\n<p>&nbsp;<\/p>\n<p>Example<\/p>\n<pre class=\"brush:js\">function add(num1, num2) {\r\n   console.log(num1 + num2);\r\n}\r\n\r\nfunction sub(num1, num2) {\r\n   console.log(num1 - num2);\r\n}\r\n\r\nfunction mul(num1, num2) {\r\n   console.log(num1 * num2);\r\n}\r\n\r\nfunction div(num1, num2) {\r\n   console.log(num1 \/ num2);\r\n}\r\n       \r\n(function () {\r\n   var num1 = 2;\r\n   var num2 = 3;\r\n\r\n   add(num1, num2);\r\n\r\n   sub(num1, num2);\r\n\r\n   mul(num1, num2);\r\n\r\n   div(num1, num2);\r\n\r\n}) ();<\/pre>\n<p>when we execute the above file in which above code is written, then let&#8217;s see what happens in the Call stack.<\/p>\n<p>1 . main function (anonymous function) of the file is pushed to the call stack.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-86036\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_2-3.png\" alt=\"\" width=\"377\" height=\"101\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_2-3.png 377w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_2-3-250x67.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_2-3-300x80.png 300w\" sizes=\"(max-width: 377px) 100vw, 377px\" loading=\"lazy\" \/><\/p>\n<p>2 . Then Self invoking function is pushed to the call stack.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-86037\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_3-2.png\" alt=\"\" width=\"382\" height=\"204\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_3-2.png 382w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_3-2-250x134.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_3-2-300x160.png 300w\" sizes=\"(max-width: 382px) 100vw, 382px\" loading=\"lazy\" \/>3 . Then div() function will go to the call stack.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-86038\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_4.png\" alt=\"\" width=\"387\" height=\"300\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_4.png 387w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_4-250x194.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_4-300x233.png 300w\" sizes=\"(max-width: 387px) 100vw, 387px\" loading=\"lazy\" \/><\/p>\n<p>Then mul(), sub() and add() functions are entered to the call stack.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-86039\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_1-2.png\" alt=\"\" width=\"378\" height=\"556\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_1-2.png 378w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_1-2-169x249.png 169w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_1-2-204x300.png 204w\" sizes=\"(max-width: 378px) 100vw, 378px\" loading=\"lazy\" \/><\/p>\n<p>After all the functions enter to the call stack now call stack executes all the function one by one from top to the bottom. means add() function will execute first which entered last into the call stack. After execution of add() function it will be removed from the call stack. And this process will continue until completion of all the functions execution. After completion call stack will be empty.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-86040\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_5-1.png\" alt=\"\" width=\"382\" height=\"473\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_5-1.png 382w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_5-1-201x249.png 201w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_5-1-242x300.png 242w\" sizes=\"(max-width: 382px) 100vw, 382px\" loading=\"lazy\" \/><\/p>\n<p>Result will be &#8211;<\/p>\n<p>5<\/p>\n<p>-1<\/p>\n<p>6<\/p>\n<p>0.66666<\/p>\n<p>Now let&#8217;s bring some twists on this above code<\/p>\n<p>we know very well about setTimeout() function right? In setTimeout() function we can call function. setTimeout() itself is an asynchronous callback function.<\/p>\n<p>Let&#8217;s have a look at the below example &#8211;<\/p>\n<pre class=\"brush:js\">function add(num1, num2) {\r\n   console.log(num1 + num2);\r\n}\r\n\r\nfunction sub(num1, num2) {\r\n   console.log(num1 - num2);\r\n}\r\n\r\nfunction mul(num1, num2) {\r\n   console.log(num1 * num2);\r\n}\r\n\r\nfunction div(num1, num2) {\r\n   console.log(num1 \/ num2);\r\n}\r\n       \r\n(function () {\r\n  var num1 = 2;\r\n  var num2 = 3;\r\n\r\n  add(num1, num2);\r\n\r\n  setTimeout(function () {\r\n     sub(num1, num2);\r\n  }, 3000);\r\n\r\n  mul(num1, num2);\r\n\r\n  setTimeout(function () {\r\n     div(num1, num2);\r\n  }, 3000);\r\n\r\n})();<\/pre>\n<p>Now let&#8217;s see what happens in call stack. All the function will enter into the call stack one by one but at the time of execution there will be some little change.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-86044\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_6-1.png\" alt=\"\" width=\"380\" height=\"556\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_6-1.png 380w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_6-1-170x249.png 170w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_6-1-205x300.png 205w\" sizes=\"(max-width: 380px) 100vw, 380px\" loading=\"lazy\" \/><\/p>\n<p>1 . First add() function will be executed then you must think sub() function will be execute but actually not because sub() function is in callback function, so it will be executed after 3 second. But you can see mul() function will be executed after the add() function.<\/p>\n<p><strong>Here event loop comes in on concurrency.<\/strong><\/p>\n<p>means some how sub() function is removed from the call stack that&#8217;s why mul() function executes because JavaScript executes codes one by one in call stack. But it will execute after 3 seconds.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-86048\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_7.png\" alt=\"\" width=\"382\" height=\"304\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_7.png 382w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_7-250x199.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/06\/Screenshot_7-300x239.png 300w\" sizes=\"(max-width: 382px) 100vw, 382px\" loading=\"lazy\" \/><\/p>\n<p>2 . Then div() function will be removed from the call stack and in the end main function (Anonymous function ()) and after 3 second sub() function will be invoked and then after 3 seconds div() function will be invoked.<\/p>\n<p>Result &#8211;<\/p>\n<p>5<\/p>\n<p>6<\/p>\n<p>-1<\/p>\n<p>0.66666<\/p>\n<p><strong>This whole process is called as Event Loop In JavaScript. <\/strong><\/p>\n<p><strong>Hope, this blog can help you to understand the Event Loop process. Thanks<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a web developer we have knowledge about the JavaScript because in modern era almost all the dynamic websites use JavaScript for better user interface. But due to complex design it&#8217;s a bit difficult to understand the execution process. Event Loop is a most popular process in JavaScript but it is not easy to understand <a href=\"https:\/\/webkul.com\/blog\/event-loop-javascript\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":71,"featured_media":84482,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[198],"tags":[2064,83,2071,590],"class_list":["post-86014","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-javascript","tag-jquery-2","tag-opencart","tag-webkul"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Event Loop In JavaScript - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/event-loop-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Event Loop In JavaScript - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"As a web developer we have knowledge about the JavaScript because in modern era almost all the dynamic websites use JavaScript for better user interface. But due to complex design it&#8217;s a bit difficult to understand the execution process. Event Loop is a most popular process in JavaScript but it is not easy to understand [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/event-loop-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-06-10T10:19:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sambit Pattanayak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sambit Pattanayak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/\"},\"author\":{\"name\":\"Sambit Pattanayak\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/23309d7bfba5b06d58b50ea5e3191f01\"},\"headline\":\"Event Loop In JavaScript\",\"datePublished\":\"2017-06-10T10:19:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/\"},\"wordCount\":533,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\",\"keywords\":[\"JavaScript\",\"jquery\",\"opencart\",\"webkul\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/event-loop-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/\",\"url\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/\",\"name\":\"Event Loop In JavaScript - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\",\"datePublished\":\"2017-06-10T10:19:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/event-loop-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png\",\"width\":\"825\",\"height\":\"260\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/event-loop-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Event Loop In JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/23309d7bfba5b06d58b50ea5e3191f01\",\"name\":\"Sambit Pattanayak\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b470681418ca47d8211cf413884189c631a12188462ba25500fa51c897318975?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b470681418ca47d8211cf413884189c631a12188462ba25500fa51c897318975?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Sambit Pattanayak\"},\"sameAs\":[\"http:\/\/webkul.com\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/sambit-p819\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Event Loop In JavaScript - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/event-loop-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Event Loop In JavaScript - Webkul Blog","og_description":"As a web developer we have knowledge about the JavaScript because in modern era almost all the dynamic websites use JavaScript for better user interface. But due to complex design it&#8217;s a bit difficult to understand the execution process. Event Loop is a most popular process in JavaScript but it is not easy to understand [...]","og_url":"https:\/\/webkul.com\/blog\/event-loop-javascript\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2017-06-10T10:19:20+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","type":"image\/png"}],"author":"Sambit Pattanayak","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Sambit Pattanayak","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/"},"author":{"name":"Sambit Pattanayak","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/23309d7bfba5b06d58b50ea5e3191f01"},"headline":"Event Loop In JavaScript","datePublished":"2017-06-10T10:19:20+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/"},"wordCount":533,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","keywords":["JavaScript","jquery","opencart","webkul"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/event-loop-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/","url":"https:\/\/webkul.com\/blog\/event-loop-javascript\/","name":"Event Loop In JavaScript - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","datePublished":"2017-06-10T10:19:20+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/event-loop-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/05\/Code-Snippet.png","width":"825","height":"260"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/event-loop-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Event Loop In JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/23309d7bfba5b06d58b50ea5e3191f01","name":"Sambit Pattanayak","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b470681418ca47d8211cf413884189c631a12188462ba25500fa51c897318975?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b470681418ca47d8211cf413884189c631a12188462ba25500fa51c897318975?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Sambit Pattanayak"},"sameAs":["http:\/\/webkul.com"],"url":"https:\/\/webkul.com\/blog\/author\/sambit-p819\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/86014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=86014"}],"version-history":[{"count":2,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/86014\/revisions"}],"predecessor-version":[{"id":86051,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/86014\/revisions\/86051"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/84482"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=86014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=86014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=86014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}