<?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: Milena Komnenic</title>
    <description>The latest articles on DEV Community by Milena Komnenic (@milena_komnenic_395b0feeb).</description>
    <link>https://dev.to/milena_komnenic_395b0feeb</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%2F1616545%2Fe8ca6054-5136-45b7-a9b7-8be53cb043c2.jpeg</url>
      <title>DEV Community: Milena Komnenic</title>
      <link>https://dev.to/milena_komnenic_395b0feeb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/milena_komnenic_395b0feeb"/>
    <language>en</language>
    <item>
      <title>Should I use console.error() or throw new Error()</title>
      <dc:creator>Milena Komnenic</dc:creator>
      <pubDate>Tue, 20 Aug 2024 07:31:43 +0000</pubDate>
      <link>https://dev.to/milena_komnenic_395b0feeb/should-i-use-consoleerror-or-throw-new-error-344l</link>
      <guid>https://dev.to/milena_komnenic_395b0feeb/should-i-use-consoleerror-or-throw-new-error-344l</guid>
      <description>&lt;p&gt;Both error handling ways seem reliable and used. But my question is:&lt;/p&gt;

&lt;p&gt;Is there a difference between them? And if there is, when should I use which?&lt;br&gt;
The key difference is: throwing halts the execution, while console.error does not.&lt;/p&gt;

&lt;p&gt;Most of the time, it's better to throw an error.&lt;br&gt;
The problem with console.error is that it does not really throw an error that stops the execution of the program , something that throw Error does .&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is the purpose of the event.preventDefault() method?</title>
      <dc:creator>Milena Komnenic</dc:creator>
      <pubDate>Tue, 20 Aug 2024 06:52:55 +0000</pubDate>
      <link>https://dev.to/milena_komnenic_395b0feeb/what-is-the-purpose-of-the-eventpreventdefault-method-39j6</link>
      <guid>https://dev.to/milena_komnenic_395b0feeb/what-is-the-purpose-of-the-eventpreventdefault-method-39j6</guid>
      <description>&lt;p&gt;Every event has a default action. Event.preventDefault() as the name suggest is used to prevent this default action.The event.preventDefault() method is used to prevent the default behavior of an event from occurring. This is commonly used in web development when handling user interactions, such as clicking on a link or submitting a form.&lt;/p&gt;

&lt;p&gt;By calling event.preventDefault(), the browser will not perform the default action associated with the event. For example, when a user clicks on a link, the browser will typically navigate to the URL specified in the link's href attribute. However, if you call event.preventDefault() on the click event of the link, the browser will not navigate to the URL, effectively preventing the default link behavior.&lt;/p&gt;

&lt;p&gt;This can be useful in scenarios where you want to handle the event in a custom way, such as:&lt;/p&gt;

&lt;p&gt;Form Submission: When a form is submitted, the browser will typically navigate to the URL specified in the action attribute of the form. By calling event.preventDefault(), you can instead handle the form submission using JavaScript.&lt;/p&gt;

&lt;p&gt;Link Clicks: As mentioned earlier, you can prevent the browser from navigating to the URL specified in the link's href attribute, allowing you to handle the click event in a custom way.&lt;/p&gt;

&lt;p&gt;Keyboard Events: You can use event.preventDefault() to prevent the default behavior of keyboard events, such as preventing the page from scrolling when the user presses the spacebar.&lt;br&gt;
By using event.preventDefault(), you can gain more control over the user interface and enable more complex and interactive experiences on the web.&lt;/p&gt;

&lt;p&gt;event.preventDefault() acts ask like return false in a method, by this the page don't get scroll up after clicking any button in the page.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
