<?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: Osama Abu Motlaq</title>
    <description>The latest articles on DEV Community by Osama Abu Motlaq (@abumotlaq).</description>
    <link>https://dev.to/abumotlaq</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%2F4096097%2F2838d183-c426-4871-8e3d-5ec488cf95bf.jpg</url>
      <title>DEV Community: Osama Abu Motlaq</title>
      <link>https://dev.to/abumotlaq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abumotlaq"/>
    <language>en</language>
    <item>
      <title>I Learned React Before I Truly Understood JavaScript — Here's What Happened</title>
      <dc:creator>Osama Abu Motlaq</dc:creator>
      <pubDate>Wed, 26 Aug 2026 18:02:31 +0000</pubDate>
      <link>https://dev.to/abumotlaq/i-learned-react-before-i-truly-understood-javascript-heres-what-happened-33cg</link>
      <guid>https://dev.to/abumotlaq/i-learned-react-before-i-truly-understood-javascript-heres-what-happened-33cg</guid>
      <description>&lt;p&gt;If you're learning web development today, there's a good chance your journey looks something like this:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhw8g3mxgq8nzuhcq8645.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhw8g3mxgq8nzuhcq8645.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML → CSS → JavaScript → React → Next.js&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At least, that's how it is supposed to go.&lt;/p&gt;

&lt;p&gt;But what if you skip the part where you truly understand JavaScript?&lt;/p&gt;

&lt;p&gt;That's exactly what I did.&lt;/p&gt;

&lt;p&gt;I learned React before I had a solid understanding of JavaScript, and at first, it felt like I was making incredible progress.&lt;/p&gt;

&lt;p&gt;I could build components.&lt;/p&gt;

&lt;p&gt;I could use &lt;code&gt;useState&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I could fetch data.&lt;/p&gt;

&lt;p&gt;I could create forms.&lt;/p&gt;

&lt;p&gt;I could build pages that looked like real applications.&lt;/p&gt;

&lt;p&gt;Everything seemed fine.&lt;/p&gt;

&lt;p&gt;Until it wasn't.&lt;/p&gt;

&lt;p&gt;Eventually, I started encountering problems that React couldn't explain for me.&lt;/p&gt;

&lt;p&gt;And that's when I realized something important:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;I wasn't struggling with React. I was struggling with JavaScript.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  React Made Me Feel Like I Was Progressing
&lt;/h2&gt;

&lt;p&gt;When you start learning React, the progress can feel exciting.&lt;/p&gt;

&lt;p&gt;You write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello World&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you learn components:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;UserCard&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="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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&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;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&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;email&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&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;p&gt;Then state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then effects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;fetchUsers&lt;/span&gt;&lt;span class="p"&gt;();&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;p&gt;And suddenly, you're building applications.&lt;/p&gt;

&lt;p&gt;That feels like real progress.&lt;/p&gt;

&lt;p&gt;But there was a problem.&lt;/p&gt;

&lt;p&gt;I could write the syntax.&lt;/p&gt;

&lt;p&gt;I couldn't always explain what was happening underneath it.&lt;/p&gt;




&lt;h1&gt;
  
  
  The First Warning Sign: Array Methods
&lt;/h1&gt;

&lt;p&gt;One of the first things that exposed this problem was something as simple as:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;activeUsers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;active&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I knew that &lt;code&gt;filter()&lt;/code&gt; returned an array.&lt;/p&gt;

&lt;p&gt;But I didn't initially understand the function being passed to it.&lt;/p&gt;

&lt;p&gt;What exactly was:&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="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;active&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why does it run multiple times?&lt;/p&gt;

&lt;p&gt;Where does &lt;code&gt;user&lt;/code&gt; come from?&lt;/p&gt;

&lt;p&gt;Why does &lt;code&gt;filter()&lt;/code&gt; return a new array?&lt;/p&gt;

&lt;p&gt;These aren't React questions.&lt;/p&gt;

&lt;p&gt;They're JavaScript questions.&lt;/p&gt;

&lt;p&gt;And React uses these concepts everywhere.&lt;/p&gt;




&lt;h1&gt;
  
  
  Then Came Destructuring
&lt;/h1&gt;

&lt;p&gt;React code is full of destructuring.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first, I treated this as React syntax.&lt;/p&gt;

&lt;p&gt;It isn't.&lt;/p&gt;

&lt;p&gt;It's JavaScript.&lt;/p&gt;

&lt;p&gt;The second example is simply array destructuring applied to the value returned by &lt;code&gt;useState()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Once I understood destructuring properly, React code became much easier to read.&lt;/p&gt;




&lt;h1&gt;
  
  
  Then I Met the Spread Operator
&lt;/h1&gt;

&lt;p&gt;Another example:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;updatedUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&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="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Osama&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I knew that this was commonly used in React.&lt;/p&gt;

&lt;p&gt;But knowing &lt;strong&gt;how to use it&lt;/strong&gt; and understanding &lt;strong&gt;what it actually does&lt;/strong&gt; are two different things.&lt;/p&gt;

&lt;p&gt;The spread syntax is JavaScript.&lt;/p&gt;

&lt;p&gt;React doesn't own it.&lt;/p&gt;

&lt;p&gt;React simply makes heavy use of JavaScript features like this.&lt;/p&gt;

&lt;p&gt;The same applies to:&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="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;every&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your JavaScript foundation is weak, React code can quickly become a collection of syntax that you memorize instead of concepts that you understand.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;code&gt;useState&lt;/code&gt; Wasn't the Real Problem
&lt;/h1&gt;

&lt;p&gt;At some point, I started asking:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Why does React need state?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I knew how to write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But understanding React state requires a deeper understanding of JavaScript concepts.&lt;/p&gt;

&lt;p&gt;Variables.&lt;/p&gt;

&lt;p&gt;References.&lt;/p&gt;

&lt;p&gt;Objects.&lt;/p&gt;

&lt;p&gt;Functions.&lt;/p&gt;

&lt;p&gt;Closures.&lt;/p&gt;

&lt;p&gt;Immutability.&lt;/p&gt;

&lt;p&gt;Execution.&lt;/p&gt;

&lt;p&gt;Re-rendering.&lt;/p&gt;

&lt;p&gt;For example:&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="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="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Osama&lt;/span&gt;&lt;span class="dl"&gt;"&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;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Ali&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This changes the existing object.&lt;/p&gt;

&lt;p&gt;But in React, you will often work with state like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nf"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;({&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="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Ali&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because understanding object references and immutable updates becomes important when working with React state.&lt;/p&gt;

&lt;p&gt;Without understanding JavaScript, React's rules can feel arbitrary.&lt;/p&gt;




&lt;h1&gt;
  
  
  Then &lt;code&gt;this&lt;/code&gt; Appeared
&lt;/h1&gt;

&lt;p&gt;JavaScript's &lt;code&gt;this&lt;/code&gt; was another wake-up call.&lt;/p&gt;

&lt;p&gt;I had seen code like:&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="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="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Osama&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

  &lt;span class="nf"&gt;sayHello&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;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&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;p&gt;Then I encountered arrow functions:&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="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="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Osama&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

  &lt;span class="na"&gt;sayHello&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&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;p&gt;Why do these behave differently?&lt;/p&gt;

&lt;p&gt;Why does &lt;code&gt;this&lt;/code&gt; depend on how a function is called?&lt;/p&gt;

&lt;p&gt;Why don't arrow functions have their own &lt;code&gt;this&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;These aren't React concepts.&lt;/p&gt;

&lt;p&gt;But if you don't understand them, JavaScript can feel unpredictable.&lt;/p&gt;

&lt;p&gt;And when JavaScript feels unpredictable, React becomes even more confusing.&lt;/p&gt;




&lt;h1&gt;
  
  
  Closures Changed Everything
&lt;/h1&gt;

&lt;p&gt;Closures were probably one of the most important concepts I eventually had to understand.&lt;/p&gt;

&lt;p&gt;Consider:&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createCounter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;;&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;p&gt;The returned function can still access &lt;code&gt;count&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because of closures.&lt;/p&gt;

&lt;p&gt;And closures are not some obscure JavaScript feature that only matters in interviews.&lt;/p&gt;

&lt;p&gt;They are fundamental to understanding how functions retain access to variables from their surrounding scope.&lt;/p&gt;

&lt;p&gt;Once you understand closures, many concepts in modern JavaScript start making more sense.&lt;/p&gt;

&lt;p&gt;Including patterns you encounter when working with React.&lt;/p&gt;




&lt;h1&gt;
  
  
  Async JavaScript Was Another Story
&lt;/h1&gt;

&lt;p&gt;Then came API requests.&lt;/p&gt;

&lt;p&gt;I started with something like:&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&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;p&gt;Then:&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;getUsers&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;response&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;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&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;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;users&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;p&gt;I knew how to write the code.&lt;/p&gt;

&lt;p&gt;But understanding asynchronous JavaScript required much more than memorizing &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;await&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I had to understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Promises&lt;/li&gt;
&lt;li&gt;Callbacks&lt;/li&gt;
&lt;li&gt;The Event Loop&lt;/li&gt;
&lt;li&gt;Microtasks&lt;/li&gt;
&lt;li&gt;Asynchronous execution&lt;/li&gt;
&lt;li&gt;Error handling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And suddenly, something that looked like a React problem turned out to be a JavaScript problem again.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Biggest Mistake Was Learning Syntax Instead of Concepts
&lt;/h1&gt;

&lt;p&gt;Looking back, I wasn't really learning React.&lt;/p&gt;

&lt;p&gt;I was learning how to make React code work.&lt;/p&gt;

&lt;p&gt;There's a big difference.&lt;/p&gt;

&lt;p&gt;Learning syntax looks like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How do I write &lt;code&gt;useEffect&lt;/code&gt;?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learning concepts looks like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What problem is &lt;code&gt;useEffect&lt;/code&gt; solving, and what does this code actually do?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learning syntax:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How do I update state?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learning concepts:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Why does React care about state updates and references?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learning syntax:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How do I fetch data?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learning concepts:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How does asynchronous JavaScript work, and what happens while I'm waiting for the response?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The second approach takes longer.&lt;/p&gt;

&lt;p&gt;But it creates a much stronger developer.&lt;/p&gt;




&lt;h1&gt;
  
  
  React Started Making More Sense After I Went Back
&lt;/h1&gt;

&lt;p&gt;Eventually, I made what felt like a step backward.&lt;/p&gt;

&lt;p&gt;I went back to JavaScript.&lt;/p&gt;

&lt;p&gt;Not because React was bad.&lt;/p&gt;

&lt;p&gt;Not because I wanted to abandon modern development.&lt;/p&gt;

&lt;p&gt;I went back because I needed the foundation.&lt;/p&gt;

&lt;p&gt;I started focusing on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Variables
Data Types
Functions
Arrays
Objects
Scope
Closures
this
Prototypes
Destructuring
Spread Syntax
Array Methods
Promises
async/await
Event Loop
Modules
DOM
Events
Error Handling
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And something interesting happened.&lt;/p&gt;

&lt;p&gt;I didn't feel like I was starting over.&lt;/p&gt;

&lt;p&gt;I was finally connecting the pieces.&lt;/p&gt;




&lt;h1&gt;
  
  
  React Became a Layer Instead of a Mystery
&lt;/h1&gt;

&lt;p&gt;Before that, React sometimes felt like a collection of special rules.&lt;/p&gt;

&lt;p&gt;After understanding JavaScript better, I started seeing React differently.&lt;/p&gt;

&lt;p&gt;React became another layer on top of concepts I already understood.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;UserCard&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&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;id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"That's React syntax."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"&lt;code&gt;map()&lt;/code&gt; is JavaScript. The arrow function is JavaScript. The object being passed is JavaScript. React is using these concepts to describe UI."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That distinction is extremely important.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Framework Shouldn't Be the Foundation
&lt;/h1&gt;

&lt;p&gt;A framework should sit &lt;strong&gt;on top of your fundamentals&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Not replace them.&lt;/p&gt;

&lt;p&gt;Think about it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                Next.js
                   ↓
                 React
                   ↓
              JavaScript
                   ↓
          Programming Fundamentals
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the bottom layer is weak, everything above it becomes harder.&lt;/p&gt;

&lt;p&gt;You can still build things.&lt;/p&gt;

&lt;p&gt;You can still follow tutorials.&lt;/p&gt;

&lt;p&gt;You can still copy patterns from documentation.&lt;/p&gt;

&lt;p&gt;But debugging becomes much harder.&lt;/p&gt;

&lt;p&gt;And sooner or later, you'll encounter a problem that the tutorial didn't cover.&lt;/p&gt;

&lt;p&gt;That's when fundamentals matter.&lt;/p&gt;




&lt;h1&gt;
  
  
  Does This Mean You Should Master JavaScript Before React?
&lt;/h1&gt;

&lt;p&gt;Not necessarily.&lt;/p&gt;

&lt;p&gt;I don't think you need to spend years learning JavaScript before touching React.&lt;/p&gt;

&lt;p&gt;You can learn both together.&lt;/p&gt;

&lt;p&gt;The important part is &lt;strong&gt;not letting React replace your JavaScript learning&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A healthy learning path could look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTML + CSS
      ↓
JavaScript Fundamentals
      ↓
Small Vanilla JS Projects
      ↓
React
      ↓
Advanced JavaScript
      ↓
Next.js / Node.js
      ↓
Full Stack Development
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don't have to know everything before moving forward.&lt;/p&gt;

&lt;p&gt;But whenever React exposes a JavaScript concept you don't understand, stop and learn that concept.&lt;/p&gt;

&lt;p&gt;That's much better than memorizing the React-specific solution.&lt;/p&gt;




&lt;h1&gt;
  
  
  Build Something Without React
&lt;/h1&gt;

&lt;p&gt;One of the best things I did was build projects using Vanilla JavaScript.&lt;/p&gt;

&lt;p&gt;Not because Vanilla JavaScript is better than React.&lt;/p&gt;

&lt;p&gt;But because it forced me to understand what was happening.&lt;/p&gt;

&lt;p&gt;For example, building a Todo application without React makes you think about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DOM manipulation&lt;/li&gt;
&lt;li&gt;Events&lt;/li&gt;
&lt;li&gt;State&lt;/li&gt;
&lt;li&gt;Data structures&lt;/li&gt;
&lt;li&gt;Array methods&lt;/li&gt;
&lt;li&gt;Forms&lt;/li&gt;
&lt;li&gt;Local Storage&lt;/li&gt;
&lt;li&gt;Rendering&lt;/li&gt;
&lt;li&gt;Updating the UI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then when you build the same kind of application with React, you start appreciating what React is actually solving.&lt;/p&gt;

&lt;p&gt;You don't just use the abstraction.&lt;/p&gt;

&lt;p&gt;You understand &lt;strong&gt;why the abstraction is useful&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Real Lesson
&lt;/h1&gt;

&lt;p&gt;The biggest lesson wasn't:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Don't learn React early."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The lesson was:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Don't let learning React prevent you from learning JavaScript."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React is an incredibly powerful tool.&lt;/p&gt;

&lt;p&gt;But tools change.&lt;/p&gt;

&lt;p&gt;Frameworks change.&lt;/p&gt;

&lt;p&gt;Libraries become unpopular.&lt;/p&gt;

&lt;p&gt;New technologies appear.&lt;/p&gt;

&lt;p&gt;The fundamentals remain.&lt;/p&gt;

&lt;p&gt;If tomorrow you move from React to another framework, your JavaScript knowledge comes with you.&lt;/p&gt;

&lt;p&gt;That's your transferable skill.&lt;/p&gt;




&lt;h1&gt;
  
  
  If You're Learning React Right Now
&lt;/h1&gt;

&lt;p&gt;Don't panic if you're already learning React.&lt;/p&gt;

&lt;p&gt;You don't need to throw away everything you've learned.&lt;/p&gt;

&lt;p&gt;Instead, whenever you encounter something you don't understand, ask:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Is this actually a React concept, or is it JavaScript?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;map()&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;JavaScript.&lt;/p&gt;

&lt;p&gt;Destructuring?&lt;/p&gt;

&lt;p&gt;JavaScript.&lt;/p&gt;

&lt;p&gt;Spread syntax?&lt;/p&gt;

&lt;p&gt;JavaScript.&lt;/p&gt;

&lt;p&gt;Closures?&lt;/p&gt;

&lt;p&gt;JavaScript.&lt;/p&gt;

&lt;p&gt;Promises?&lt;/p&gt;

&lt;p&gt;JavaScript.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;async/await&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;JavaScript.&lt;/p&gt;

&lt;p&gt;Modules?&lt;/p&gt;

&lt;p&gt;JavaScript.&lt;/p&gt;

&lt;p&gt;Objects and references?&lt;/p&gt;

&lt;p&gt;JavaScript.&lt;/p&gt;

&lt;p&gt;Once you start making this distinction, your learning becomes much more structured.&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Learning React before deeply understanding JavaScript wasn't a complete mistake.&lt;/p&gt;

&lt;p&gt;It actually taught me something valuable.&lt;/p&gt;

&lt;p&gt;It showed me exactly &lt;strong&gt;why fundamentals matter&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;React can help you build applications faster.&lt;/p&gt;

&lt;p&gt;But JavaScript helps you understand what your application is actually doing.&lt;/p&gt;

&lt;p&gt;You don't have to choose between modern frameworks and strong fundamentals.&lt;/p&gt;

&lt;p&gt;Learn both.&lt;/p&gt;

&lt;p&gt;Use React.&lt;/p&gt;

&lt;p&gt;Build with Next.js.&lt;/p&gt;

&lt;p&gt;Work with Node.js.&lt;/p&gt;

&lt;p&gt;Explore the ecosystem.&lt;/p&gt;

&lt;p&gt;But whenever you feel that a framework is doing something "magical," go one level deeper.&lt;/p&gt;

&lt;p&gt;Ask what's happening underneath.&lt;/p&gt;

&lt;p&gt;Because eventually, you'll discover that much of the "magic" isn't magic at all.&lt;/p&gt;

&lt;p&gt;It's JavaScript.&lt;/p&gt;

&lt;p&gt;And the better you understand JavaScript, the less mysterious React becomes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Don't learn React to avoid JavaScript. Learn JavaScript so you can truly understand React.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>Vanilla JavaScript — Why It Still Matters in the Age of React and Next.js</title>
      <dc:creator>Osama Abu Motlaq</dc:creator>
      <pubDate>Wed, 26 Aug 2026 17:39:22 +0000</pubDate>
      <link>https://dev.to/abumotlaq/vanilla-javascript-why-it-still-matters-in-the-age-of-react-and-nextjs-2a7o</link>
      <guid>https://dev.to/abumotlaq/vanilla-javascript-why-it-still-matters-in-the-age-of-react-and-nextjs-2a7o</guid>
      <description>&lt;h1&gt;
  
  
  Vanilla JavaScript — Why It Still Matters in the Age of React and Next.js
&lt;/h1&gt;

&lt;p&gt;In modern web development, it's easy to feel like JavaScript alone is no longer enough.&lt;/p&gt;

&lt;p&gt;You open GitHub or LinkedIn and see:&lt;/p&gt;

&lt;p&gt;React.&lt;/p&gt;

&lt;p&gt;Next.js.&lt;/p&gt;

&lt;p&gt;Vue.&lt;/p&gt;

&lt;p&gt;Angular.&lt;/p&gt;

&lt;p&gt;TypeScript.&lt;/p&gt;

&lt;p&gt;Vite.&lt;/p&gt;

&lt;p&gt;And sometimes dozens of libraries that a project seems to need before you even write your first line of code.&lt;/p&gt;

&lt;p&gt;So beginners often ask:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"If all these tools exist, why should I learn Vanilla JavaScript?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's a reasonable question.&lt;/p&gt;

&lt;p&gt;But the problem is that many developers learn the tools built on top of JavaScript before understanding the language those tools are built on.&lt;/p&gt;

&lt;p&gt;It's like learning to drive a modern car without understanding the basics of controlling a vehicle.&lt;/p&gt;

&lt;p&gt;You may be able to drive.&lt;/p&gt;

&lt;p&gt;But when something unexpected happens, it becomes much harder to understand why.&lt;/p&gt;




&lt;h1&gt;
  
  
  What Does Vanilla JavaScript Mean?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Vanilla JavaScript&lt;/strong&gt; isn't a different programming language.&lt;/p&gt;

&lt;p&gt;It's simply a term developers use when they mean JavaScript without a framework or library such as React or Vue.&lt;/p&gt;

&lt;p&gt;For example:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#btn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Button clicked&lt;/span&gt;&lt;span class="dl"&gt;"&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;p&gt;That's Vanilla JavaScript.&lt;/p&gt;

&lt;p&gt;No React.&lt;/p&gt;

&lt;p&gt;No Vue.&lt;/p&gt;

&lt;p&gt;No jQuery.&lt;/p&gt;

&lt;p&gt;Just JavaScript and the Web APIs provided by the browser.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why Does a React Developer Need Vanilla JavaScript?
&lt;/h1&gt;

&lt;p&gt;Because React doesn't replace JavaScript.&lt;/p&gt;

&lt;p&gt;React is built with JavaScript and runs within the JavaScript ecosystem.&lt;/p&gt;

&lt;p&gt;When you write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you're using JavaScript.&lt;/p&gt;

&lt;p&gt;When you write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you're using JavaScript.&lt;/p&gt;

&lt;p&gt;And when you work with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Promise
async
await
fetch
map
filter
reduce
objects
arrays
destructuring
modules
closures
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you're working with JavaScript.&lt;/p&gt;

&lt;p&gt;React provides a way to organize and build user interfaces.&lt;/p&gt;

&lt;p&gt;It doesn't replace the language itself.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Problem Starts When You Learn a Framework Before the Language
&lt;/h1&gt;

&lt;p&gt;Imagine someone starts learning development like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTML
↓
React
↓
Next.js
↓
Node.js
↓
MongoDB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They can build a beautiful page.&lt;/p&gt;

&lt;p&gt;But when they encounter:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;age&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;they don't know why &lt;code&gt;filter&lt;/code&gt; works.&lt;/p&gt;

&lt;p&gt;Or:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&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="na"&gt;active&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;they don't understand Spread Syntax.&lt;/p&gt;

&lt;p&gt;Or:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&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;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;they don't understand what &lt;code&gt;await&lt;/code&gt; actually does.&lt;/p&gt;

&lt;p&gt;That's when the problem becomes clear.&lt;/p&gt;

&lt;p&gt;A developer can use a framework without truly understanding the language underneath it.&lt;/p&gt;




&lt;h1&gt;
  
  
  A Framework Is Not a Replacement for Fundamentals
&lt;/h1&gt;

&lt;p&gt;Frameworks solve important problems.&lt;/p&gt;

&lt;p&gt;React, for example, helps developers build user interfaces in a structured and reusable way.&lt;/p&gt;

&lt;p&gt;Next.js adds a large set of capabilities on top of React for building web applications.&lt;/p&gt;

&lt;p&gt;But when something goes wrong inside these tools, you often end up going back to JavaScript.&lt;/p&gt;

&lt;p&gt;This happens all the time.&lt;/p&gt;

&lt;p&gt;The problem might involve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scope&lt;/li&gt;
&lt;li&gt;Closures&lt;/li&gt;
&lt;li&gt;Objects&lt;/li&gt;
&lt;li&gt;Arrays&lt;/li&gt;
&lt;li&gt;References&lt;/li&gt;
&lt;li&gt;Asynchronous JavaScript&lt;/li&gt;
&lt;li&gt;Promises&lt;/li&gt;
&lt;li&gt;Event Loop&lt;/li&gt;
&lt;li&gt;Modules&lt;/li&gt;
&lt;li&gt;DOM&lt;/li&gt;
&lt;li&gt;Browser APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The stronger your JavaScript foundation is, the easier frameworks become.&lt;/p&gt;




&lt;h1&gt;
  
  
  Vanilla JavaScript Forces You to Understand What Is Happening
&lt;/h1&gt;

&lt;p&gt;When you use a framework, many details are organized or abstracted away from you.&lt;/p&gt;

&lt;p&gt;That's a good thing.&lt;/p&gt;

&lt;p&gt;But when you work with Vanilla JavaScript, you are forced to interact with things such as:&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="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This helps you understand the relationship between JavaScript and the browser.&lt;/p&gt;

&lt;p&gt;You're not just learning how to write code.&lt;/p&gt;

&lt;p&gt;You're learning about the environment in which that code runs.&lt;/p&gt;




&lt;h1&gt;
  
  
  The DOM Is Not JavaScript
&lt;/h1&gt;

&lt;p&gt;This is a very important distinction.&lt;/p&gt;

&lt;p&gt;Many beginners assume that:&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="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is part of the JavaScript language itself.&lt;/p&gt;

&lt;p&gt;The reality is more precise.&lt;/p&gt;

&lt;p&gt;JavaScript is a programming language.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;document&lt;/code&gt;, &lt;code&gt;window&lt;/code&gt;, &lt;code&gt;localStorage&lt;/code&gt;, &lt;code&gt;fetch&lt;/code&gt;, and many other APIs are provided by the environment in which JavaScript runs.&lt;/p&gt;

&lt;p&gt;In a browser, you have Web APIs.&lt;/p&gt;

&lt;p&gt;In Node.js, you have a different set of APIs.&lt;/p&gt;

&lt;p&gt;Understanding this distinction becomes increasingly important as you go deeper into JavaScript.&lt;/p&gt;




&lt;h1&gt;
  
  
  A Simple Example
&lt;/h1&gt;

&lt;p&gt;Suppose we have a button:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Click me&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can interact with it using Vanilla JavaScript:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#btn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello!&lt;/span&gt;&lt;span class="dl"&gt;"&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;p&gt;Several things are happening here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JavaScript gets a reference to the element.&lt;/li&gt;
&lt;li&gt;The browser provides the &lt;code&gt;document&lt;/code&gt; API.&lt;/li&gt;
&lt;li&gt;We register an event listener.&lt;/li&gt;
&lt;li&gt;The browser waits for a &lt;code&gt;click&lt;/code&gt; event.&lt;/li&gt;
&lt;li&gt;When the event occurs, the callback function runs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once you understand this process, many React concepts become easier to understand.&lt;/p&gt;




&lt;h1&gt;
  
  
  React Doesn't Make These Concepts Disappear
&lt;/h1&gt;

&lt;p&gt;When you write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Button&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Clicked&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      Click me
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&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;p&gt;it may look completely different.&lt;/p&gt;

&lt;p&gt;But the underlying ideas haven't disappeared.&lt;/p&gt;

&lt;p&gt;You still have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Events&lt;/li&gt;
&lt;li&gt;Callbacks&lt;/li&gt;
&lt;li&gt;Objects&lt;/li&gt;
&lt;li&gt;State&lt;/li&gt;
&lt;li&gt;Asynchronous behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;React provides a different abstraction and structure for building user interfaces.&lt;/p&gt;

&lt;p&gt;But JavaScript is still underneath it.&lt;/p&gt;




&lt;h1&gt;
  
  
  Vanilla JavaScript Teaches You to Solve Problems Before Reaching for a Library
&lt;/h1&gt;

&lt;p&gt;There is a common habit among some developers:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I need to do X, so I'll find a library that does X."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That isn't always wrong.&lt;/p&gt;

&lt;p&gt;The problem starts when it becomes the only solution.&lt;/p&gt;

&lt;p&gt;A good developer asks first:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Do I actually need a library for this?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes the problem is extremely simple.&lt;/p&gt;

&lt;p&gt;For example:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;uniqueUsers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;)];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don't need a library just to remove duplicate values.&lt;/p&gt;

&lt;p&gt;Or:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;activeUsers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;active&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don't need a library to filter data.&lt;/p&gt;

&lt;p&gt;Or:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userNames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don't need a library to extract values from an array.&lt;/p&gt;

&lt;p&gt;Understanding JavaScript reduces your dependence on libraries for simple problems.&lt;/p&gt;




&lt;h1&gt;
  
  
  But This Doesn't Mean Vanilla JavaScript Is Always Better
&lt;/h1&gt;

&lt;p&gt;This is where we need to be realistic.&lt;/p&gt;

&lt;p&gt;I'm not saying:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Don't use React."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And I'm not saying:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Vanilla JavaScript is better than frameworks."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's not true.&lt;/p&gt;

&lt;p&gt;As an application grows, manually managing the UI, state, and component structure can become complicated.&lt;/p&gt;

&lt;p&gt;That's where frameworks and libraries become valuable.&lt;/p&gt;

&lt;p&gt;The problem isn't using tools.&lt;/p&gt;

&lt;p&gt;The problem is using them without understanding the problem they're solving.&lt;/p&gt;




&lt;h1&gt;
  
  
  When Should You Use Vanilla JavaScript?
&lt;/h1&gt;

&lt;p&gt;Vanilla JavaScript is excellent for projects such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple interactive websites&lt;/li&gt;
&lt;li&gt;Landing pages&lt;/li&gt;
&lt;li&gt;Small tools&lt;/li&gt;
&lt;li&gt;Scripts&lt;/li&gt;
&lt;li&gt;Widgets&lt;/li&gt;
&lt;li&gt;Prototypes&lt;/li&gt;
&lt;li&gt;Educational projects&lt;/li&gt;
&lt;li&gt;Projects that don't require a framework&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's also excellent for learning.&lt;/p&gt;

&lt;p&gt;Because you interact directly with JavaScript and the browser.&lt;/p&gt;




&lt;h1&gt;
  
  
  When Do You Need React or a Framework?
&lt;/h1&gt;

&lt;p&gt;As a project grows, you may need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Component Architecture&lt;/li&gt;
&lt;li&gt;State Management&lt;/li&gt;
&lt;li&gt;Reusable UI&lt;/li&gt;
&lt;li&gt;Routing&lt;/li&gt;
&lt;li&gt;Complex Interactions&lt;/li&gt;
&lt;li&gt;Data Fetching&lt;/li&gt;
&lt;li&gt;Large Application Structure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At that point, frameworks such as React and Next.js can become a logical choice.&lt;/p&gt;

&lt;p&gt;But using these tools doesn't make understanding JavaScript less important.&lt;/p&gt;

&lt;p&gt;It makes it even more important.&lt;/p&gt;




&lt;h1&gt;
  
  
  Vanilla JavaScript Is Not a Phase You Should Leave Behind
&lt;/h1&gt;

&lt;p&gt;Sometimes Vanilla JavaScript is treated as a temporary stage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;JavaScript
↓
React
↓
Forget JavaScript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the better path looks more like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;JavaScript
↓
Deep JavaScript Understanding
↓
React
↓
Next.js
↓
Full Stack
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each stage builds on the previous one.&lt;/p&gt;

&lt;p&gt;You don't move from JavaScript to React so that you can forget JavaScript.&lt;/p&gt;

&lt;p&gt;You move to React because you're ready to use a higher-level tool.&lt;/p&gt;




&lt;h1&gt;
  
  
  What Should You Understand Before React?
&lt;/h1&gt;

&lt;p&gt;You don't need to become an expert in everything.&lt;/p&gt;

&lt;p&gt;But you should be comfortable with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Variables
Data Types
Functions
Arrays
Objects
Destructuring
Spread Syntax
Rest Parameters
Array Methods
Scope
Closures
this
DOM
Events
Promises
async/await
Fetch API
Modules
Error Handling
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you start learning React, many concepts will already feel familiar.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Best Way to Learn Vanilla JavaScript
&lt;/h1&gt;

&lt;p&gt;Don't just watch tutorials.&lt;/p&gt;

&lt;p&gt;Build small projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Todo List
&lt;/h3&gt;

&lt;p&gt;You'll learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DOM&lt;/li&gt;
&lt;li&gt;Events&lt;/li&gt;
&lt;li&gt;Arrays&lt;/li&gt;
&lt;li&gt;Objects&lt;/li&gt;
&lt;li&gt;Local Storage&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Weather App
&lt;/h3&gt;

&lt;p&gt;You'll learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetch&lt;/li&gt;
&lt;li&gt;Promises&lt;/li&gt;
&lt;li&gt;Async/Await&lt;/li&gt;
&lt;li&gt;APIs&lt;/li&gt;
&lt;li&gt;Error Handling&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quiz App
&lt;/h3&gt;

&lt;p&gt;You'll learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;State-like logic&lt;/li&gt;
&lt;li&gt;Events&lt;/li&gt;
&lt;li&gt;Arrays&lt;/li&gt;
&lt;li&gt;Objects&lt;/li&gt;
&lt;li&gt;Conditional Rendering&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Expense Tracker
&lt;/h3&gt;

&lt;p&gt;You'll learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data manipulation&lt;/li&gt;
&lt;li&gt;Forms&lt;/li&gt;
&lt;li&gt;Local Storage&lt;/li&gt;
&lt;li&gt;Array methods&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After building these projects, React will feel much less mysterious.&lt;/p&gt;




&lt;h1&gt;
  
  
  JavaScript First, Tools Second
&lt;/h1&gt;

&lt;p&gt;One of the biggest challenges in the modern JavaScript ecosystem is the sheer number of tools.&lt;/p&gt;

&lt;p&gt;Every week, a new library may appear.&lt;/p&gt;

&lt;p&gt;A new framework.&lt;/p&gt;

&lt;p&gt;A new tool.&lt;/p&gt;

&lt;p&gt;A new way of building applications.&lt;/p&gt;

&lt;p&gt;If you try to memorize all of them, you'll enter a race that never ends.&lt;/p&gt;

&lt;p&gt;But if you understand JavaScript well, you can learn new tools much faster.&lt;/p&gt;

&lt;p&gt;Because you aren't starting from zero.&lt;/p&gt;

&lt;p&gt;You're simply learning:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to use a new tool to solve a problem you already understand.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Vanilla JavaScript isn't a competitor to React.&lt;/p&gt;

&lt;p&gt;And it's not an outdated technology that should be discarded.&lt;/p&gt;

&lt;p&gt;It's the foundation that makes React, Node.js, Next.js, and the rest of the JavaScript ecosystem easier to understand.&lt;/p&gt;

&lt;p&gt;You can learn a framework without deeply understanding JavaScript.&lt;/p&gt;

&lt;p&gt;You may even be able to build a working application.&lt;/p&gt;

&lt;p&gt;But when something unexpected happens, you'll often find yourself searching for a ready-made solution instead of understanding the underlying cause.&lt;/p&gt;

&lt;p&gt;When your foundation is strong, frameworks become tools.&lt;/p&gt;

&lt;p&gt;And that's the real goal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't learn JavaScript just so you can use React.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn JavaScript so you can understand what React is doing when you use it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the end, the best developer isn't the person who knows the largest number of libraries.&lt;/p&gt;

&lt;p&gt;It's the person who understands the problem, knows when to use JavaScript directly, knows when a higher-level tool is needed, and—most importantly—understands why.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>vanillajavascript</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
    <item>
      <title>JavaScript — A Programming Mess That Succeeded by Accident</title>
      <dc:creator>Osama Abu Motlaq</dc:creator>
      <pubDate>Wed, 26 Aug 2026 17:14:12 +0000</pubDate>
      <link>https://dev.to/abumotlaq/javascript-a-programming-mess-that-succeeded-by-accident-938</link>
      <guid>https://dev.to/abumotlaq/javascript-a-programming-mess-that-succeeded-by-accident-938</guid>
      <description>&lt;h1&gt;
  
  
  JavaScript — A Programming Mess That Succeeded by Accident
&lt;/h1&gt;

&lt;p&gt;If you've been writing JavaScript for a while, you've probably had a moment when you asked yourself:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Why was the language designed this way?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Why do we have &lt;code&gt;==&lt;/code&gt; and &lt;code&gt;===&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;Why are there both &lt;code&gt;null&lt;/code&gt; and &lt;code&gt;undefined&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;Why can the result of some operations be so strange?&lt;/p&gt;

&lt;p&gt;Why does &lt;code&gt;this&lt;/code&gt; behave differently depending on how a function is called?&lt;/p&gt;

&lt;p&gt;And why do you sometimes need to understand the history of the language to understand why certain behaviors exist?&lt;/p&gt;

&lt;p&gt;It's easy to look at JavaScript and say that it's a language full of strange design decisions.&lt;/p&gt;

&lt;p&gt;But the truth is more interesting.&lt;/p&gt;

&lt;p&gt;JavaScript wasn't originally built to become the language we know today.&lt;/p&gt;

&lt;p&gt;It started as a simple language for the web, then expanded dramatically and eventually became a fundamental part of modern web development—from the browser to the server, from mobile applications to developer tools.&lt;/p&gt;

&lt;p&gt;That's why it can be described, somewhat humorously, as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;JavaScript — a programming mess that succeeded by accident.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But was it really an accident?&lt;/p&gt;




&lt;h1&gt;
  
  
  The Beginning Was Much Simpler
&lt;/h1&gt;

&lt;p&gt;When JavaScript appeared in the mid-1990s, the goal wasn't to build massive modern applications.&lt;/p&gt;

&lt;p&gt;The primary goal was to add some interactivity to web pages.&lt;/p&gt;

&lt;p&gt;The web at that time was completely different from the web we know today.&lt;/p&gt;

&lt;p&gt;There was no React, Vue, or Angular.&lt;/p&gt;

&lt;p&gt;There was no Node.js.&lt;/p&gt;

&lt;p&gt;Modern web applications didn't exist in their current form.&lt;/p&gt;

&lt;p&gt;Web pages relied heavily on HTML, and there was a growing need for a language that could interact with the page and add dynamic behavior.&lt;/p&gt;

&lt;p&gt;And that's where JavaScript came in.&lt;/p&gt;

&lt;p&gt;The problem was that the language evolved incredibly quickly.&lt;/p&gt;

&lt;p&gt;What seemed like a reasonable decision at the time eventually became part of the language that had to be preserved because of compatibility with millions of websites and applications.&lt;/p&gt;

&lt;p&gt;And that's where the real story of JavaScript begins.&lt;/p&gt;




&lt;p&gt;One of the biggest reasons JavaScript can feel strange is that the language cannot simply throw away its history.&lt;/p&gt;

&lt;p&gt;When a programming language is used by millions of projects, changing old behavior can potentially break a huge number of applications.&lt;/p&gt;

&lt;p&gt;As a result, many historical behaviors have to remain.&lt;/p&gt;

&lt;p&gt;Even when they no longer look like the best possible design.&lt;/p&gt;

&lt;p&gt;And this explains a large part of the "mess."&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;code&gt;==&lt;/code&gt; vs &lt;code&gt;===&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;One of the most famous examples is:&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="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While:&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="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reason is that &lt;code&gt;==&lt;/code&gt; allows &lt;strong&gt;type coercion&lt;/strong&gt;, meaning that JavaScript may convert types during the comparison.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;===&lt;/code&gt;, on the other hand, compares both the value and the type without performing the same kind of implicit conversion.&lt;/p&gt;

&lt;p&gt;That's why you'll usually see developers prefer:&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="o"&gt;===&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;over:&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="o"&gt;==&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not because &lt;code&gt;==&lt;/code&gt; doesn't work, but because &lt;code&gt;===&lt;/code&gt; is generally clearer and less likely to produce unexpected results.&lt;/p&gt;

&lt;p&gt;And this leads to one of the most important lessons in JavaScript:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It's not enough to know what the code does. You should understand why it does it.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;code&gt;null&lt;/code&gt; vs &lt;code&gt;undefined&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;We also have two values that may look very similar:&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="kc"&gt;null&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and:&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="kc"&gt;undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But they are used differently.&lt;/p&gt;

&lt;p&gt;In simple terms:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;undefined&lt;/code&gt; often means that a value hasn't been assigned or isn't available.&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;username&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;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While &lt;code&gt;null&lt;/code&gt; is commonly used to explicitly represent the absence of a value.&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;selectedUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In other words, the developer is explicitly saying:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There is a variable, but it currently has no value.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Having two different values for situations that can appear similar may seem confusing, but it's part of the language's history and behavior that has become part of the ecosystem.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;code&gt;typeof null&lt;/code&gt;... Wait, What?
&lt;/h1&gt;

&lt;p&gt;Now we come to one of JavaScript's most famous oddities:&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;typeof&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"object"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though &lt;code&gt;null&lt;/code&gt; isn't an object in the way a modern developer would normally expect.&lt;/p&gt;

&lt;p&gt;This is one of those behaviors that became part of the language's historical legacy.&lt;/p&gt;

&lt;p&gt;The lesson isn't simply to memorize this strange fact.&lt;/p&gt;

&lt;p&gt;The more important lesson is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Programming languages aren't always designed from scratch according to the best possible design.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some languages evolve on top of old decisions and have to maintain compatibility with the past.&lt;/p&gt;




&lt;h1&gt;
  
  
  JavaScript Isn't a "Bad Language"
&lt;/h1&gt;

&lt;p&gt;After seeing examples like these, it's easy to say:&lt;/p&gt;

&lt;p&gt;"JavaScript is a bad language."&lt;/p&gt;

&lt;p&gt;But that's an unfair conclusion.&lt;/p&gt;

&lt;p&gt;Every programming language has design decisions that not every developer will like.&lt;/p&gt;

&lt;p&gt;More importantly, modern JavaScript is not simply the same language that appeared in the 1990s.&lt;/p&gt;

&lt;p&gt;The language has evolved dramatically.&lt;/p&gt;

&lt;p&gt;Features such as these have been introduced:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Arrow Functions&lt;/li&gt;
&lt;li&gt;Classes&lt;/li&gt;
&lt;li&gt;Modules&lt;/li&gt;
&lt;li&gt;Promises&lt;/li&gt;
&lt;li&gt;&lt;code&gt;async/await&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Destructuring&lt;/li&gt;
&lt;li&gt;Spread Syntax&lt;/li&gt;
&lt;li&gt;Optional Chaining&lt;/li&gt;
&lt;li&gt;Nullish Coalescing&lt;/li&gt;
&lt;li&gt;Iterators&lt;/li&gt;
&lt;li&gt;Generators&lt;/li&gt;
&lt;li&gt;And many more&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, instead of relying on older patterns for asynchronous operations, we can now write:&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;getUsers&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;response&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;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&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;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;users&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;p&gt;This shows how the language has evolved to become more powerful and more comfortable to work with.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Problem Isn't Just JavaScript
&lt;/h1&gt;

&lt;p&gt;There is another important point to understand:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript is more than just a programming language.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is part of a huge ecosystem.&lt;/p&gt;

&lt;p&gt;Today, when you say JavaScript, you may be talking about:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;JavaScript
│
├── Browser
│
├── Node.js
│
├── React
│
├── Next.js
│
├── Express
│
├── TypeScript
│
├── npm
│
└── Thousands of libraries and tools
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this is one of JavaScript's greatest strengths.&lt;/p&gt;

&lt;p&gt;The language started as a scripting language inside the browser, but it eventually became the foundation of an entire development ecosystem.&lt;/p&gt;




&lt;h1&gt;
  
  
  From the Browser to the Server
&lt;/h1&gt;

&lt;p&gt;One of the biggest transformations in JavaScript's history was the emergence of Node.js.&lt;/p&gt;

&lt;p&gt;Suddenly, JavaScript was no longer limited to the browser.&lt;/p&gt;

&lt;p&gt;Developers could use JavaScript to build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web Servers&lt;/li&gt;
&lt;li&gt;REST APIs&lt;/li&gt;
&lt;li&gt;Backend Applications&lt;/li&gt;
&lt;li&gt;CLI Tools&lt;/li&gt;
&lt;li&gt;Automation&lt;/li&gt;
&lt;li&gt;Real-time Applications&lt;/li&gt;
&lt;li&gt;Developer Tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This made JavaScript one of the few languages that developers can use across both sides of an application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Frontend
   ↓
JavaScript
   ↓
Backend
   ↓
Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then came powerful frameworks and libraries such as React, Express, Next.js, and many others.&lt;/p&gt;




&lt;h1&gt;
  
  
  Its Success Wasn't Entirely Accidental
&lt;/h1&gt;

&lt;p&gt;The title of this article says:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"A Programming Mess That Succeeded by Accident."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But if we want to be more precise, JavaScript's success wasn't simply an accident.&lt;/p&gt;

&lt;p&gt;Many factors contributed to it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. It Was Already in the Browser
&lt;/h2&gt;

&lt;p&gt;JavaScript became a fundamental part of the web.&lt;/p&gt;

&lt;p&gt;That gave it an enormous user base.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. It Was Easy to Get Started With
&lt;/h2&gt;

&lt;p&gt;You could simply write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;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;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello World&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You didn't need to build a complicated project just to get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The Language Kept Evolving
&lt;/h2&gt;

&lt;p&gt;JavaScript didn't stop at its original design.&lt;/p&gt;

&lt;p&gt;It continued to evolve and introduce new capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The Rise of Node.js
&lt;/h2&gt;

&lt;p&gt;Node.js dramatically expanded JavaScript's use beyond the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. A Massive Ecosystem
&lt;/h2&gt;

&lt;p&gt;The existence of npm, libraries, frameworks, and developer tools made JavaScript capable of handling many different types of projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. React and What Came After
&lt;/h2&gt;

&lt;p&gt;Modern frontend libraries and frameworks made JavaScript an essential part of building large web applications.&lt;/p&gt;




&lt;h1&gt;
  
  
  What Should a JavaScript Developer Learn?
&lt;/h1&gt;

&lt;p&gt;One of the biggest mistakes beginners can make is jumping directly into a framework.&lt;/p&gt;

&lt;p&gt;They might start like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTML
↓
React
↓
Next.js
↓
Node.js
↓
MongoDB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then they encounter a simple JavaScript problem and have no idea why it happens.&lt;/p&gt;

&lt;p&gt;A better approach is to build a strong foundation first.&lt;/p&gt;

&lt;p&gt;Start by understanding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Variables
Data Types
Operators
Functions
Arrays
Objects
Scope
Closures
this
Prototypes
Classes
DOM
Events
Promises
Async/Await
Modules
Error Handling
Fetch API
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then move on to frameworks and ecosystem tools.&lt;/p&gt;

&lt;p&gt;Because React won't make you a good JavaScript developer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding JavaScript will make you a better React developer.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Don't Memorize JavaScript's Weirdness — Understand It
&lt;/h1&gt;

&lt;p&gt;You may find long lists online titled:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"100 Weird Things About JavaScript."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They're entertaining, but that's not the real goal.&lt;/p&gt;

&lt;p&gt;A good developer doesn't memorize:&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="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or:&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;typeof&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;just to prove that they know JavaScript's quirks.&lt;/p&gt;

&lt;p&gt;What matters more is understanding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Type Coercion&lt;/li&gt;
&lt;li&gt;Equality&lt;/li&gt;
&lt;li&gt;Scope&lt;/li&gt;
&lt;li&gt;Execution Context&lt;/li&gt;
&lt;li&gt;Closures&lt;/li&gt;
&lt;li&gt;Prototypes&lt;/li&gt;
&lt;li&gt;Event Loop&lt;/li&gt;
&lt;li&gt;Asynchronous JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you understand these concepts, many of JavaScript's "weird" behaviors stop being mysterious and become predictable.&lt;/p&gt;




&lt;h1&gt;
  
  
  Sometimes the Mess Is Part of the Success
&lt;/h1&gt;

&lt;p&gt;That's the interesting paradox of JavaScript.&lt;/p&gt;

&lt;p&gt;If the language had disappeared because of its early design flaws, we wouldn't have what we have today:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;React
Next.js
Node.js
Express
Electron
React Native
Vite
npm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And thousands of tools and libraries built around JavaScript and TypeScript.&lt;/p&gt;

&lt;p&gt;Its massive success created a new problem:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It became extremely difficult to change the past.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's why modern JavaScript carries layers of history on top of each other.&lt;/p&gt;

&lt;p&gt;Old decisions.&lt;/p&gt;

&lt;p&gt;New features.&lt;/p&gt;

&lt;p&gt;Backward compatibility.&lt;/p&gt;

&lt;p&gt;Modern tools.&lt;/p&gt;

&lt;p&gt;Frameworks.&lt;/p&gt;

&lt;p&gt;Libraries.&lt;/p&gt;

&lt;p&gt;All working together within one enormous ecosystem.&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;JavaScript isn't a perfect language.&lt;/p&gt;

&lt;p&gt;And honestly, I don't think there is such a thing as a perfect programming language.&lt;/p&gt;

&lt;p&gt;But JavaScript is an excellent example of how &lt;strong&gt;success in programming isn't determined only by the quality of a language's original design.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes the deciding factors are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Timing&lt;/li&gt;
&lt;li&gt;Adoption&lt;/li&gt;
&lt;li&gt;Community&lt;/li&gt;
&lt;li&gt;Ecosystem&lt;/li&gt;
&lt;li&gt;Backward compatibility&lt;/li&gt;
&lt;li&gt;The ability to evolve&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So perhaps the better description is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;JavaScript isn't simply a mess that succeeded by accident. It's a language that started small, accumulated decades of history, and evolved into one of the foundations of the modern web.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you're learning JavaScript today, don't try to run away from the strange parts of the language.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understand them.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because the more you understand why the language behaves the way it does, the less you rely on memorization—and the better you become at writing predictable, maintainable code.&lt;/p&gt;

&lt;p&gt;And in the end, that's the difference between someone who knows JavaScript...&lt;/p&gt;

&lt;p&gt;and someone who &lt;strong&gt;understands JavaScript&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
