<?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: noothan</title>
    <description>The latest articles on DEV Community by noothan (@noothan).</description>
    <link>https://dev.to/noothan</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%2F1155083%2F9a49cf89-a8be-4358-87ec-da6e394cceb9.jpg</url>
      <title>DEV Community: noothan</title>
      <link>https://dev.to/noothan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/noothan"/>
    <language>en</language>
    <item>
      <title>URL Validation In JavaScript</title>
      <dc:creator>noothan</dc:creator>
      <pubDate>Wed, 20 Sep 2023 10:31:36 +0000</pubDate>
      <link>https://dev.to/noothan/url-validation-in-javascript-6j2</link>
      <guid>https://dev.to/noothan/url-validation-in-javascript-6j2</guid>
      <description>&lt;h2&gt;
  
  
  URL Validation in JavaScript (2023 edition)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For many years, there has been no easy way to validate URLs in JavaScript. However, with the introduction of the &lt;code&gt;URL.canParse()&lt;/code&gt; method, this is no longer the case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;URL.canParse()&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;URL.canParse()&lt;/code&gt; is a static method on the &lt;code&gt;URL&lt;/code&gt; constructor. It takes a URL string as input and returns &lt;code&gt;true&lt;/code&gt; if the URL is valid and &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/p&gt;

&lt;p&gt;To use &lt;code&gt;URL.canParse()&lt;/code&gt;, simply pass the URL string to the method. For example:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
javascript
const url = "https://www.stefanjudis.com/blog/validate-urls-in-javascript/";

if (URL.canParse(url)) {
  console.log("The URL is valid.");
} else {
  console.log("The URL is invalid.");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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