{"id":8602,"date":"2025-02-23T11:00:39","date_gmt":"2025-02-23T05:30:39","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=8602"},"modified":"2025-02-23T11:00:43","modified_gmt":"2025-02-23T05:30:43","slug":"async-await","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/async-await\/","title":{"rendered":"Async\/Await"},"content":{"rendered":"\n<p>The async\/await syntax is a special syntax created to help you work with promise objects. It makes your code cleaner and clearer.<\/p>\n\n\n\n<p>When handling Promise, we need to chain the call to the function or variable that returns a\u00a0Promise using\u00a0then\/catch methods.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Async Keyword<\/h2>\n\n\n\n<p>We use the\u00a0async keyword with a function to represent that the function is an asynchronous function. The async function returns a promise.<\/p>\n\n\n\n<p>async function name(parameter1, parameter2, \u2026paramaterN) {<br>\/\/ statements<br>}<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"187\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10-1024x187.png\" alt=\"\" class=\"wp-image-8603\" style=\"width:763px;height:auto\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10-1024x187.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10-300x55.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10-768x140.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10-1536x281.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10-2048x374.png 2048w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10-850x155.png 850w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>In this snippet the\u00a0async\u00a0keyword is used before the function to represent that the function is asynchronous.<\/p>\n\n\n\n<p>Since this function returns a promise, we can use the chaining method\u00a0then<code>()<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.37.38.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"228\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.37.38-1024x228.png\" alt=\"\" class=\"wp-image-8604\" style=\"width:759px;height:auto\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.37.38-1024x228.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.37.38-300x67.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.37.38-768x171.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.37.38-1536x342.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.37.38-850x189.png 850w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.37.38.png 2038w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>In this snippet <code>f()<\/code>\u00a0function is resolved and the\u00a0then<code>()<\/code>\u00a0method gets executed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Await Keyword<\/h2>\n\n\n\n<p>The\u00a0await keyword is used inside the\u00a0async\u00a0function to wait for the asynchronous operation. <\/p>\n\n\n\n<p>let result = await promise<\/p>\n\n\n\n<p>The use of\u00a0await\u00a0pauses the async function until the promise returns a result (resolve or reject) value. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.41.37.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"288\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.41.37-1024x288.png\" alt=\"\" class=\"wp-image-8605\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.41.37-1024x288.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.41.37-300x84.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.41.37-768x216.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.41.37-1536x432.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.41.37-2048x576.png 2048w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.41.37-850x239.png 850w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>In this snipper a\u00a0Promise\u00a0object is created and it gets resolved after 4000 milliseconds. Here, the\u00a0asyncFunc<code>()<\/code>\u00a0function is written using the\u00a0async\u00a0function. The\u00a0await\u00a0keyword waits for the promise to be complete (resolve or reject).<\/p>\n\n\n\n<p>Hence,\u00a0hello\u00a0is displayed only after promise value is available to the\u00a0result\u00a0variable. If\u00a0<code>await<\/code>\u00a0is not used,\u00a0hello\u00a0is displayed before\u00a0Promise resolved.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Error Handling<\/h2>\n\n\n\n<p>While using the\u00a0<code>async<\/code>\u00a0function, we  write the code in a synchronous manner. And you can also use the\u00a0catch<code>()<\/code>\u00a0method to catch the error.\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.47.44.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"353\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.47.44-1024x353.png\" alt=\"\" class=\"wp-image-8606\" style=\"width:727px;height:auto\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.47.44-1024x353.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.47.44-300x104.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.47.44-768x265.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.47.44-1536x530.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.47.44-850x293.png 850w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.47.44.png 1982w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>In this snippet try\/catch\u00a0block to handle the errors. If the program runs successfully, it will go to the\u00a0try\u00a0block. And if the program throws an error, it will go to the\u00a0catch\u00a0block.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Promise vs Async\/Await Code Comparison<\/h2>\n\n\n\n<p>In the async\/await version, the result of the promise is directly assigned to a variable. In the standard promise version, the result of the promise is passed as an argument to the\u00a0.then()\u00a0method.<\/p>\n\n\n\n<p>Most of them prefer the async\/await version as it looks more straightforward.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"320\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/image-1-1024x320.png\" alt=\"\" class=\"wp-image-8607\" style=\"width:724px;height:auto\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/image-1-1024x320.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/image-1-300x94.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/image-1-768x240.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/image-1-1536x480.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/image-1-850x266.png 850w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/image-1.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How to Use Async\/Await in IIFE and Arrow Functions<\/h2>\n\n\n\n<p>An Immediately Invoked Function Expression (IIFE) is a technique used to execute a function immediately as soon as you define it.Unlike regular functions and variables, IIFEs will be removed from the running process once they are executed.<\/p>\n\n\n\n<p>Aside from the standard function, we can also make an asynchronous IIFE. This is useful when we need to run the asynchronous function only once.<\/p>\n\n\n\n<p>(async function () {<br>try {<br>const response = await fetch(&#8216;https:\/\/jsonplaceholder.typicode.com\/todos\/1&#8217;);<br>const json = await response.json();<br>console.log(json);<br>} catch (error) {<br>console.log(error);<br>}<br>})();<\/p>\n\n\n\n<p><strong>\u00a0Arrow syntax when creating an asynchronous function<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-left\">const runProcess = async () =&gt; {<br>try {<br>const response = await fetch(&#8216;https:\/\/jsonplaceholder.typicode.com\/todos\/1&#8217;);<br>const json = await response.json();<br>console.log(json);<br>} catch (error) {<br>console.log(error);<br>}<br>};<\/p>\n\n\n\n<p class=\"has-text-align-left\">runProcess();<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"benefits\">Benefits of Using async Function<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The code is more readable than using a\u00a0callback or a promise.<\/li>\n\n\n\n<li>Error handling is simpler.<\/li>\n\n\n\n<li>Debugging is easier.<\/li>\n<\/ul>\n\n\n\n<p><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The async\/await syntax is a special syntax created to help you work with promise objects. It makes your code cleaner and clearer. When handling Promise, we need to chain the call to the function or variable that returns a\u00a0Promise using\u00a0then\/catch methods. Async Keyword We use the\u00a0async keyword with a function&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/async-await\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">Async\/Await<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":517,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-8602","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-uncategorized","7":"h-entry","9":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pheonix Solutions - We Empower Your Business Growth<\/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:\/\/pheonixsolutions.com\/blog\/async-await\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pheonix Solutions - We Empower Your Business Growth\" \/>\n<meta property=\"og:description\" content=\"The async\/await syntax is a special syntax created to help you work with promise objects. It makes your code cleaner and clearer. When handling Promise, we need to chain the call to the function or variable that returns a\u00a0Promise using\u00a0then\/catch methods. Async Keyword We use the\u00a0async keyword with a function&hellip; Continue Reading Async\/Await\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/async-await\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-23T05:30:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-23T05:30:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2090\" \/>\n\t<meta property=\"og:image:height\" content=\"382\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"rithani S.R\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rithani S.R\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/\"},\"author\":{\"name\":\"rithani S.R\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/4ef46a5281ce472ec238b189bc91492c\"},\"headline\":\"Async\\\/Await\",\"datePublished\":\"2025-02-23T05:30:39+00:00\",\"dateModified\":\"2025-02-23T05:30:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/\"},\"wordCount\":497,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/Screenshot-2025-02-23-at-10.35.10-1024x187.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/\",\"name\":\"Pheonix Solutions - We Empower Your Business Growth\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/Screenshot-2025-02-23-at-10.35.10-1024x187.png\",\"datePublished\":\"2025-02-23T05:30:39+00:00\",\"dateModified\":\"2025-02-23T05:30:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/#primaryimage\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/Screenshot-2025-02-23-at-10.35.10.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/Screenshot-2025-02-23-at-10.35.10.png\",\"width\":2090,\"height\":382},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/async-await\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Async\\\/Await\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/4ef46a5281ce472ec238b189bc91492c\",\"name\":\"rithani S.R\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2e5bfa0516df11177982adde1a5c1886cb9d88dadfceb10b05b4481f516b8789?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2e5bfa0516df11177982adde1a5c1886cb9d88dadfceb10b05b4481f516b8789?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2e5bfa0516df11177982adde1a5c1886cb9d88dadfceb10b05b4481f516b8789?s=96&r=g\",\"caption\":\"rithani S.R\"},\"sameAs\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-admin\"],\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/rithani\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pheonix Solutions - We Empower Your Business Growth","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:\/\/pheonixsolutions.com\/blog\/async-await\/","og_locale":"en_US","og_type":"article","og_title":"Pheonix Solutions - We Empower Your Business Growth","og_description":"The async\/await syntax is a special syntax created to help you work with promise objects. It makes your code cleaner and clearer. When handling Promise, we need to chain the call to the function or variable that returns a\u00a0Promise using\u00a0then\/catch methods. Async Keyword We use the\u00a0async keyword with a function&hellip; Continue Reading Async\/Await","og_url":"https:\/\/pheonixsolutions.com\/blog\/async-await\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2025-02-23T05:30:39+00:00","article_modified_time":"2025-02-23T05:30:43+00:00","og_image":[{"width":2090,"height":382,"url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10.png","type":"image\/png"}],"author":"rithani S.R","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"rithani S.R","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/"},"author":{"name":"rithani S.R","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/4ef46a5281ce472ec238b189bc91492c"},"headline":"Async\/Await","datePublished":"2025-02-23T05:30:39+00:00","dateModified":"2025-02-23T05:30:43+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/"},"wordCount":497,"commentCount":0,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/#primaryimage"},"thumbnailUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10-1024x187.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/async-await\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/","url":"https:\/\/pheonixsolutions.com\/blog\/async-await\/","name":"Pheonix Solutions - We Empower Your Business Growth","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/#primaryimage"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/#primaryimage"},"thumbnailUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10-1024x187.png","datePublished":"2025-02-23T05:30:39+00:00","dateModified":"2025-02-23T05:30:43+00:00","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/async-await\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/#primaryimage","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-23-at-10.35.10.png","width":2090,"height":382},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/async-await\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Async\/Await"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/4ef46a5281ce472ec238b189bc91492c","name":"rithani S.R","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2e5bfa0516df11177982adde1a5c1886cb9d88dadfceb10b05b4481f516b8789?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2e5bfa0516df11177982adde1a5c1886cb9d88dadfceb10b05b4481f516b8789?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2e5bfa0516df11177982adde1a5c1886cb9d88dadfceb10b05b4481f516b8789?s=96&r=g","caption":"rithani S.R"},"sameAs":["https:\/\/pheonixsolutions.com\/blog\/wp-admin"],"url":"https:\/\/pheonixsolutions.com\/blog\/author\/rithani\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-2eK","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8602","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/517"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=8602"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8602\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}