<?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: Elid</title>
    <description>The latest articles on DEV Community by Elid (@elidvenega).</description>
    <link>https://dev.to/elidvenega</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%2F966291%2F2bfc3e69-620b-457c-a2fd-4303ab7717e5.jpeg</url>
      <title>DEV Community: Elid</title>
      <link>https://dev.to/elidvenega</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/elidvenega"/>
    <language>en</language>
    <item>
      <title>Svelte Counter I made to understand runes</title>
      <dc:creator>Elid</dc:creator>
      <pubDate>Mon, 18 Nov 2024 22:06:51 +0000</pubDate>
      <link>https://dev.to/elidvenega/svelte-counter-i-made-to-understand-runes-a49</link>
      <guid>https://dev.to/elidvenega/svelte-counter-i-made-to-understand-runes-a49</guid>
      <description>&lt;p&gt;The final result.&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.amazonaws.com%2Fuploads%2Farticles%2Fnnwmzvs92dg6ukxcznar.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.amazonaws.com%2Fuploads%2Farticles%2Fnnwmzvs92dg6ukxcznar.png" alt="Image description" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the Svelte code I wrote to create a counter.&lt;/p&gt;

&lt;p&gt;Link to &lt;a href="https://svelte.dev/playground/73d46a97804b43aa8ccbc9047fa4fd23?version=5.2.3" rel="noopener noreferrer"&gt;code&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script&amp;gt;
  let number = $state(0);
  let currentValue = $derived(number);

  const addByOne = () =&amp;gt; (number += 1);
  const decreaseByOne = () =&amp;gt; (number &amp;gt; 0 ? (number -= 1) : 0);
  const reset = () =&amp;gt; (number = 0);
  const multiplyByTwo = () =&amp;gt; (number *= 2);
&amp;lt;/script&amp;gt;

&amp;lt;div class="container"&amp;gt;
  &amp;lt;h1&amp;gt;Counter: {number}&amp;lt;/h1&amp;gt;
  &amp;lt;button class="addBtn" onclick={addByOne}&amp;gt;Add By One&amp;lt;/button&amp;gt;
  &amp;lt;button class="decreaseBtn" onclick={decreaseByOne}&amp;gt;Decrease By One&amp;lt;/button&amp;gt;
  &amp;lt;button onclick={reset}&amp;gt;Reset&amp;lt;/button&amp;gt;
  &amp;lt;button onclick={multiplyByTwo}&amp;gt;Multiply By Two&amp;lt;/button&amp;gt;
  &amp;lt;p&amp;gt;Current Value is: {currentValue}&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;style&amp;gt;
  :root {
    --backgound_color: #1e293b;
    --font_family: fantasy;
    --btn_color: #18181b;
    --btn_add_color: #047857;
    --btn_decrease_color: #dc2626;
  }

  .container {
    background-color: var(--backgound_color);
    font-family: var(--font_family);
    text-align: center;
    max-width: 100%;
    height: 100vh;
    padding: 3rem;
  }

  h1 {
    font-size: 3rem;
  }

  button {
    background-color: var(--btn_color);
    border: none;
    border-radius: 5px;
    font-family: var(--font_family);
    font-size: 18px;
    padding: 10px;
  }

  .addBtn {
    background-color: var(--btn_add_color);
  }

  .decreaseBtn {
    background-color: var(--btn_decrease_color);
  }

  p {
    font-size: 2rem;
  }
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>svelte</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>html</category>
    </item>
    <item>
      <title>The JS map() method</title>
      <dc:creator>Elid</dc:creator>
      <pubDate>Mon, 13 May 2024 19:07:39 +0000</pubDate>
      <link>https://dev.to/elidvenega/the-js-map-method-2a0d</link>
      <guid>https://dev.to/elidvenega/the-js-map-method-2a0d</guid>
      <description>&lt;p&gt;The map() method in JavaScript returns to you a new array by calling a function for every element it does not mutate. The original array just creates a copy this is used a lot in React so is something good to know along with other JS methods.&lt;/p&gt;

&lt;p&gt;const numbersList = [1, 2, 4, 5];&lt;/p&gt;

&lt;p&gt;// example&lt;br&gt;
const mapArr = numbersList.map((n) =&amp;gt; n + 1);&lt;br&gt;
console.log(mapArr) &lt;/p&gt;

&lt;p&gt;// Output [2, 3, 5, 6]; &lt;br&gt;
// I will also console the original array to see no changes made&lt;br&gt;
console.log(numbersList);&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>map</category>
      <category>methods</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Functions for beginners</title>
      <dc:creator>Elid</dc:creator>
      <pubDate>Mon, 07 Nov 2022 20:22:06 +0000</pubDate>
      <link>https://dev.to/elidvenega/functions-for-beginners-588f</link>
      <guid>https://dev.to/elidvenega/functions-for-beginners-588f</guid>
      <description>&lt;p&gt;JS functions are a block of code that can be reused anywhere in your code, one of the building blocks of JS the example will be a function declaration.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
// Declaring a function&lt;br&gt;
function twoNumbers(num1 , num2) {&lt;br&gt;
 return  num1 * num2&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// Calling the function&lt;br&gt;
twoNumbers(10, 2);&lt;/p&gt;

&lt;p&gt;//This code would output 20;&lt;/p&gt;

&lt;p&gt;So you see from the example you put in the parameters whatever two numbers you like to  put (num1, num2).Then when you are ready to call the function in the argument twoNumbers(10, 2) or whatever two numbers you like output it to the console in your browser.&lt;/p&gt;

&lt;p&gt;console.log(twoNumbers(10, 2));&lt;/p&gt;

&lt;p&gt;This will output in the console I use chrome so I click ctrl + shift + i&lt;/p&gt;

&lt;p&gt;You can do the same in ES6 Arrow Functions which will be much more less code and no return statement needed if is one line.&lt;/p&gt;

&lt;p&gt;// Arrow function&lt;br&gt;
const twoNumbers = (num1 , num2) =&amp;gt;  num1 * num2;&lt;br&gt;
console.log(twoNumbers(10, 2)); //20&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>funnctions</category>
    </item>
  </channel>
</rss>
