<?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: Julian</title>
    <description>The latest articles on DEV Community by Julian (@srsury).</description>
    <link>https://dev.to/srsury</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%2F4013021%2F10f67ccf-d538-412a-b2fe-1f5ca0432ca8.png</url>
      <title>DEV Community: Julian</title>
      <link>https://dev.to/srsury</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/srsury"/>
    <language>en</language>
    <item>
      <title>How a Single Letter Ruined My 2D Array Code for 20 Minutes 😅</title>
      <dc:creator>Julian</dc:creator>
      <pubDate>Fri, 03 Jul 2026 05:21:52 +0000</pubDate>
      <link>https://dev.to/srsury/how-a-single-letter-ruined-my-2d-array-code-for-20-minutes-1mki</link>
      <guid>https://dev.to/srsury/how-a-single-letter-ruined-my-2d-array-code-for-20-minutes-1mki</guid>
      <description>&lt;p&gt;Hey everyone! 👋&lt;/p&gt;

&lt;p&gt;Today, while working on my journey as a computer science student, I was tackling a &lt;strong&gt;2D Arrays challenge&lt;/strong&gt; in JavaScript. Everything seemed perfect. The logic made sense, the loops looked solid... but the code just wouldn't work.&lt;/p&gt;

&lt;p&gt;I spent about 20 minutes staring at the screen, running mental tests, and questioning my programming skills.&lt;/p&gt;

&lt;p&gt;Can you spot the error in this snippet?&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;for&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;j&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="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&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;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;j&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;span class="k"&gt;for&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;k&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="nx"&gt;k&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;lenght&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="c1"&gt;// Logic here&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;Yeah... it was the 't' at the end of &lt;code&gt;matrix[j].lenght&lt;/code&gt;. I wrote &lt;strong&gt;lenght&lt;/strong&gt; instead of &lt;strong&gt;length&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The JavaScript Trap 🪤
&lt;/h3&gt;

&lt;p&gt;The worst part about this specific typo in JavaScript is that the console won't throw an explicit error. JS just looks at &lt;code&gt;matrix[j].lenght&lt;/code&gt;, says &lt;em&gt;"Well, that property doesn't exist, so it's&lt;/em&gt; &lt;code&gt;undefined&lt;/code&gt;&lt;em&gt;"&lt;/em&gt;, and moves on.&lt;/p&gt;

&lt;p&gt;Since &lt;code&gt;k &amp;lt; undefined&lt;/code&gt; evaluates to &lt;code&gt;false&lt;/code&gt;, the inner loop never executed, leaving me completely stuck.&lt;/p&gt;

&lt;h3&gt;
  
  
  My Lesson of the Day 💡
&lt;/h3&gt;

&lt;p&gt;I felt a bit silly when I finally noticed that tiny mistake, but it reminded me of two valuable lessons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Always check the typos first&lt;/strong&gt; before assuming your entire logic is broken.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use linters or spell checkers!&lt;/strong&gt; (Time to install one in my editor ASAP).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you are also learning to code, don't feel bad when these things happen. It's a classic rite of passage for every developer!&lt;/p&gt;

&lt;p&gt;Have you ever lost hours of work because of a single misplaced letter? Let me know in the comments! 👇&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Follow my journey as I build in public!&lt;/em&gt; 🚀&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginnerdevelopers</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
