<?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: Matthew Oluwabusayo Opoola </title>
    <description>The latest articles on DEV Community by Matthew Oluwabusayo Opoola  (@matthewoluwabusayoopoola).</description>
    <link>https://dev.to/matthewoluwabusayoopoola</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F914666%2Fd35fbfdc-31f2-40e9-8430-7de7c31f1ccc.png</url>
      <title>DEV Community: Matthew Oluwabusayo Opoola </title>
      <link>https://dev.to/matthewoluwabusayoopoola</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/matthewoluwabusayoopoola"/>
    <language>en</language>
    <item>
      <title>Syntax, logical and runtime errors</title>
      <dc:creator>Matthew Oluwabusayo Opoola </dc:creator>
      <pubDate>Tue, 17 Jan 2023 20:45:55 +0000</pubDate>
      <link>https://dev.to/matthewoluwabusayoopoola/syntax-logical-and-runtime-errors-1721</link>
      <guid>https://dev.to/matthewoluwabusayoopoola/syntax-logical-and-runtime-errors-1721</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SHbrRa9r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c0wy2vvyu0j6hhxzjjj1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SHbrRa9r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c0wy2vvyu0j6hhxzjjj1.png" alt="Image description" width="299" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By the end of this reading, you'll be able to:&lt;br&gt;
• Recognize common types of errors in JavaScript&lt;br&gt;
Here are some of the most common errors in JavaScript: &lt;br&gt;
• ReferenceError &lt;br&gt;
• SyntaxError &lt;br&gt;
• TypeError &lt;br&gt;
• RangeError&lt;br&gt;
There are some other errors in JavaScript. These other errors include: &lt;br&gt;
• AggregateError &lt;br&gt;
• Error &lt;br&gt;
• InternalError &lt;br&gt;
• URIError&lt;br&gt;
However, in this reading I'll focus on the Reference, Syntax, Type, and Range errors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ReferenceError&lt;/strong&gt;&lt;br&gt;
A ReferenceError gets thrown when, for example, one tries to use variables that haven't been declared anywhere.&lt;br&gt;
An example can be, say, attempting to console log a variable that doesn't exist:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(username);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the variable named &lt;code&gt;username&lt;/code&gt; hasn't been declared, the above line of code will result in the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Uncaught ReferenceError: username is not defined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;SyntaxError&lt;/strong&gt;&lt;br&gt;
Any kind of invalid JavaScript code will cause a SyntaxError.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var a "there's no assignment operator here";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above line of code will throw the following error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Uncaught SyntaxError: Unexpected string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's an interesting caveat regarding the SyntaxError in JavaScript: it cannot be caught using the try-catch block. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TypeError&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A TypeError is thrown when, for example, trying to run a method on a non-supported data type.&lt;br&gt;
A simple example is attempting to run the pop() method on a string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"hello".pop() // Uncaught TypeError: "hello".pop is not a function
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, as can be confirmed by running the above line of code, strings do not have all the array methods readily available to them, and trying to use some of those methods will result in a TypeError being thrown. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RangeError&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A RangeError is thrown when we're giving a value to a function, but that value is out of the allowed range of acceptable input values.&lt;br&gt;
Here's a simple example of converting an everyday Base 10 number (a number of the common decimal system) to a Base 2 number (i.e binary number).&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(10).toString(2); // '1010'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The value of 2 when passed to the toString() method, is like saying to JavaScript: "convert the value of 10 of the Base 10 number system, to its counter-part in the Base 2 number system".&lt;br&gt;
JavaScript obliges and "translates" the "regular" number 10 to its binary counter-part.&lt;br&gt;
Besides using Base 2 number system, I can also use the Base 8, 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;(10).toString(8); // 12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I get back the value 12, which is the plain number 10, writen in Base 8 number system.&lt;br&gt;
However, if I try to use a non-existing number system, such as an imaginary Base 100, since this number system effectively doesn't exist in JavaScript, I will get the RangeError, because a non-existing Base 100 system is out of range of the number systems that are available to the toString() method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(10).toString(100); // Uncaught RangeError: toString() radix argument must be between 2 and 36
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this reading you have covered some of the common errors in JavaScript &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>I'M NEW HERE, WHAT'S UP</title>
      <dc:creator>Matthew Oluwabusayo Opoola </dc:creator>
      <pubDate>Wed, 24 Aug 2022 13:45:00 +0000</pubDate>
      <link>https://dev.to/matthewoluwabusayoopoola/im-new-here-whats-up-1hce</link>
      <guid>https://dev.to/matthewoluwabusayoopoola/im-new-here-whats-up-1hce</guid>
      <description>&lt;p&gt;How are you all&lt;/p&gt;

</description>
      <category>announcement</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
