<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: منصور</title>
    <description>The latest articles on DEV Community by منصور (@man313our).</description>
    <link>https://dev.to/man313our</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1833919%2F184f3b92-8fe6-4a39-b49b-808f4a8f6080.jpeg</url>
      <title>DEV Community: منصور</title>
      <link>https://dev.to/man313our</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/man313our"/>
    <language>en</language>
    <item>
      <title>🚀 Building, Learning, and Growing Together</title>
      <dc:creator>منصور</dc:creator>
      <pubDate>Sun, 26 Jul 2026 19:21:22 +0000</pubDate>
      <link>https://dev.to/man313our/building-learning-and-growing-together-4gb</link>
      <guid>https://dev.to/man313our/building-learning-and-growing-together-4gb</guid>
      <description>&lt;p&gt;One of the most exciting things about software development is that the journey never really ends.&lt;/p&gt;

&lt;p&gt;Every day brings new challenges, new tools, and new ideas. But true growth comes not only from learning — it comes from sharing knowledge, experiences, and solutions with the community.&lt;/p&gt;

&lt;p&gt;As developers, what we create is more than just code. We build connections, contribute ideas, and help shape the future of technology.&lt;/p&gt;

&lt;p&gt;Let’s keep:&lt;br&gt;
✅ Sharing our experiences&lt;br&gt;
✅ Learning from each other&lt;br&gt;
✅ Asking better questions&lt;br&gt;
✅ Building better solutions together&lt;/p&gt;

&lt;p&gt;Happy coding! 💻🚀&lt;/p&gt;

</description>
      <category>tech</category>
      <category>opensource</category>
      <category>programming</category>
    </item>
    <item>
      <title>Master Async/Await: How to Write Cleaner and Faster JavaScript</title>
      <dc:creator>منصور</dc:creator>
      <pubDate>Sun, 26 Jul 2026 19:15:55 +0000</pubDate>
      <link>https://dev.to/man313our/master-asyncawait-how-to-write-cleaner-and-faster-javascript-1gdf</link>
      <guid>https://dev.to/man313our/master-asyncawait-how-to-write-cleaner-and-faster-javascript-1gdf</guid>
      <description>&lt;h1&gt;
  
  
  How to Write Cleaner and Faster JavaScript
&lt;/h1&gt;

&lt;p&gt;As JavaScript developers, we deal with asynchronous operations every single day—whether it's fetching data from an API, reading files, or talking to a database. &lt;/p&gt;

&lt;p&gt;For years, we used callbacks (and suffered in Callback Hell), then we moved to Promises. Today, &lt;code&gt;async/await&lt;/code&gt; is the gold standard. But are you using it efficiently, or are you accidentally slowing down your application?&lt;/p&gt;

&lt;p&gt;In this post, we’ll look at how to avoid common pitfalls and write cleaner, faster async code.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Common Mistake: The "Async/Await Ferry"
&lt;/h2&gt;

&lt;p&gt;Look at this common pattern. We need to fetch user data and a list of products:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;NewbieWay&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetchUserData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Takes 2 seconds&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetchProducts&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Takes 2 seconds&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why this is bad:
&lt;/h3&gt;

&lt;p&gt;The code looks clean, but it runs &lt;strong&gt;sequentially&lt;/strong&gt;. &lt;code&gt;fetchProducts&lt;/code&gt; will not start until &lt;code&gt;fetchUserData&lt;/code&gt; is completely finished. The total execution time is &lt;strong&gt;4 seconds&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Since these two API calls do not depend on each other, waiting for the first one to finish is a waste of time.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. The Solution: Parallel Execution with &lt;code&gt;Promise.all&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;To speed things up, we should start both operations at the same time and wait for both to finish together.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ProWay&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Start both requests in parallel&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userPromise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fetchUserData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;productsPromise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fetchProducts&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// Wait for both to resolve&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;userPromise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;productsPromise&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why this is awesome:
&lt;/h3&gt;

&lt;p&gt;Both requests are sent at the exact same moment. The total execution time drops from 4 seconds to &lt;strong&gt;just 2 seconds&lt;/strong&gt;. You just doubled your app's performance with a simple tweak!&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Don't Forget Error Handling
&lt;/h2&gt;

&lt;p&gt;When using &lt;code&gt;Promise.all&lt;/code&gt;, if &lt;strong&gt;one&lt;/strong&gt; promise fails, the whole thing rejects. Always wrap your code in a &lt;code&gt;try/catch&lt;/code&gt; block to handle errors gracefully.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;SafeAndFast&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
      &lt;span class="nf"&gt;fetchUserData&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
      &lt;span class="nf"&gt;fetchProducts&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Failed to fetch data:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// Handle error (e.g., show a notification to the user)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;async/await&lt;/code&gt; makes JavaScript code look synchronous and easy to read, but don't forget the asynchronous power underneath. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use standard &lt;code&gt;await&lt;/code&gt; when task B needs data from task A.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;Promise.all&lt;/code&gt; when tasks are independent.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What is your favorite way to handle async operations in JavaScript? Let me know in the comments below! 🚀&lt;/p&gt;

&lt;h1&gt;
  
  
  javascript #webdev #programming #tutorial
&lt;/h1&gt;

</description>
      <category>javascript</category>
      <category>howto</category>
    </item>
  </channel>
</rss>
