<?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: Naveenchandar</title>
    <description>The latest articles on DEV Community by Naveenchandar (@naveenchandar).</description>
    <link>https://dev.to/naveenchandar</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%2F396661%2Fe27ecfc7-6d2d-40aa-ad74-b2a367f30deb.jpeg</url>
      <title>DEV Community: Naveenchandar</title>
      <link>https://dev.to/naveenchandar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/naveenchandar"/>
    <language>en</language>
    <item>
      <title>Event Handling in React: A Beginner’s Guide</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Thu, 24 Apr 2025 17:04:16 +0000</pubDate>
      <link>https://dev.to/naveenchandar/event-handling-in-react-a-beginners-guide-518d</link>
      <guid>https://dev.to/naveenchandar/event-handling-in-react-a-beginners-guide-518d</guid>
      <description>&lt;p&gt;Handling events like clicks, form submissions, and key presses is a fundamental part of building interactive UIs. In this guide, we’ll break down how event handling works in React, the key differences from vanilla JavaScript, and best practices to keep your code clean and efficient.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Are Events in React?
&lt;/h2&gt;

&lt;p&gt;In React, events are triggered in response to user actions—just like in plain JavaScript. The difference? React wraps the native events in a &lt;strong&gt;synthetic event system&lt;/strong&gt;, which provides a consistent interface across all browsers.&lt;/p&gt;




&lt;h2&gt;
  
  
  Basic Event Handling Syntax
&lt;/h2&gt;

&lt;p&gt;Here’s what a simple click handler looks like in React:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;MyButton&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Button was clicked!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Click Me&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;onClick&lt;/code&gt; is camelCase (unlike HTML’s &lt;code&gt;onclick&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;You pass a &lt;strong&gt;function reference&lt;/strong&gt; (not a string)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Common Event Types in React
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Event&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;onClick&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Mouse click&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;onChange&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Input value change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;onSubmit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Form submission&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;onKeyDown&lt;/code&gt; / &lt;code&gt;onKeyUp&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Keyboard interaction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;onMouseEnter&lt;/code&gt; / &lt;code&gt;onMouseLeave&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Hover effects&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Handling Form Inputs
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;FormExample&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleChange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleChange&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&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;React gives full control over form elements by treating them as &lt;strong&gt;controlled components&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Passing Arguments to Event Handlers
&lt;/h2&gt;

&lt;p&gt;You can pass arguments using arrow functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Delete&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or bind it (not recommended in functional components):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Delete&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Synthetic Events vs Native Events
&lt;/h2&gt;

&lt;p&gt;React uses a synthetic event system which:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Works across all browsers consistently&lt;/li&gt;
&lt;li&gt;Pools events for performance (though this behavior has been relaxed in React 17+)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can still access the native event using &lt;code&gt;e.nativeEvent&lt;/code&gt; if needed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;arrow functions or separate handlers&lt;/strong&gt; to keep code readable&lt;/li&gt;
&lt;li&gt;Avoid inline functions inside JSX &lt;em&gt;unless needed for props&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Clean up event listeners if manually attaching them (e.g., &lt;code&gt;window.addEventListener&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Bonus Tip: Custom Events in React
&lt;/h2&gt;

&lt;p&gt;Need to create custom interactions between components? Pass handlers via props:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Parent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;onChildClick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Child clicked&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Child&lt;/span&gt; &lt;span class="na"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onChildClick&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Click me&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Event handling in React is simple once you understand the syntax and mindset behind it. Whether you're managing input fields or creating advanced interactive components, React's synthetic events and modular approach make handling user actions clean and powerful.&lt;/p&gt;

&lt;p&gt;Ready to level up? Try combining event handling with hooks like &lt;code&gt;useEffect&lt;/code&gt; or context-based state updates to build even smarter UIs!&lt;/p&gt;

&lt;p&gt;Happy coding! ✨&lt;/p&gt;

&lt;p&gt;🔍 Preparing for React interviews?&lt;br&gt;
I’ve put together a curated guide to help you master every important topic—from basics to advanced patterns.&lt;br&gt;
&lt;a href="https://naviindev.gumroad.com/l/reactinterviewguide" rel="noopener noreferrer"&gt;👉 Check out the React Interview Guide&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Throttling vs Debouncing in JavaScript</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Sun, 13 Apr 2025 07:53:34 +0000</pubDate>
      <link>https://dev.to/naveenchandar/throttling-vs-debouncing-in-javascript-4no5</link>
      <guid>https://dev.to/naveenchandar/throttling-vs-debouncing-in-javascript-4no5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Optimizing performance&lt;/strong&gt; is essential in building modern web applications. To deliver a smooth and responsive user experience, developers often rely on various techniques to boost efficiency. Among these, &lt;strong&gt;debouncing&lt;/strong&gt; and &lt;strong&gt;throttling&lt;/strong&gt; stand out as simple yet highly effective strategies used in JavaScript to enhance performance.&lt;/p&gt;

&lt;p&gt;In this post, we'll explore what debouncing and throttling are, how they differ, and why they're important tools for managing performance in JavaScript applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Debouncing?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delays function execution until a certain time has passed since the last call.&lt;/li&gt;
&lt;li&gt;Best for: search inputs, auto-save, resize events.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function debounce(fn, delay) {
  let timer;
  return function(...args) {
    clearTimeout(timer);
    timer = setTimeout(() =&amp;gt; fn.apply(this, args), delay);
  };
}

const handleInput = debounce((e) =&amp;gt; {
  console.log("API call for:", e.target.value);
}, 300);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's say you have a search input field and you want to make an API call to fetch search results. Without debouncing, an API call would be made every time the user enters a character, which could lead to a large number of unnecessary api calls. Debouncing ensures that the API call is only made after the user has stopped typing for a specified amount of time.&lt;/p&gt;

&lt;p&gt;In the above example, debouncing ensures to call api only after user stopped typing for 300ms of time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Throttling&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensures a function is only called once per specified time interval.&lt;/li&gt;
&lt;li&gt;Best for: scroll events, window resize, mouse movement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function throttle(func, limit) {
  let inThrottle;
  return function (...args) {
    if (!inThrottle) {
      func.apply(this, args);
      inThrottle = true;
      setTimeout(() =&amp;gt; (inThrottle = false), limit);
    }
  };
}

// Usage
const handleResize = throttle(() =&amp;gt; {
  // Update element positions
  console.log('Window resized');
}, 100);

window.addEventListener('resize', handleResize);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's say you have a function that updates the position of elements on the screen based on the window size. Without throttling, this function could be called many times per second as the user resizes the window, leading to performance issues. Throttling ensures that the function is only called once in a specified time interval.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debouncing and Throttling in React&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using useCallback with custom debounce/throttle functions.&lt;/li&gt;
&lt;li&gt;Optional: Introduce lodash.debounce or lodash.throttle.&lt;/li&gt;
&lt;li&gt;using custom hooks to handle debounce or throttle which will be single point of contact and reusable across the project.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useEffect, useState } from 'react';

function useDebounce(value, delay = 500) {
  const [debouncedValue, setDebouncedValue] = useState(value);

  useEffect(() =&amp;gt; {
    const timer = setTimeout(() =&amp;gt; {
      setDebouncedValue(value);
    }, delay);

    return () =&amp;gt; {
      clearTimeout(timer);
    };
  }, [value, delay]);

  return debouncedValue;
}

function App() {
  const [searchTerm, setSearchTerm] = useState('');
  const debouncedSearchTerm = useDebounce(searchTerm, 1000);

  useEffect(() =&amp;gt; {
    fetch(apiCall)
  }, [debouncedSearchTerm]);

  const handleChange = (event) =&amp;gt; {
    setSearchTerm(event.target.value);
  };

  return (
     &amp;lt;div className="container"&amp;gt;
      &amp;lt;input
        type="text"
        placeholder="Search character..."
        value={searchTerm}
        onChange={handleChange}
      /&amp;gt;
     &amp;lt;/div&amp;gt;  
  )
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Further reading&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Debounce" rel="noopener noreferrer"&gt;Debounce&lt;/a&gt;&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Throttle" rel="noopener noreferrer"&gt;Throttle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading this post. Have a great day. 🙂&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>react</category>
    </item>
    <item>
      <title>IIFE in Javascript</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Tue, 01 Apr 2025 12:49:32 +0000</pubDate>
      <link>https://dev.to/naveenchandar/iife-in-javascript-1ob4</link>
      <guid>https://dev.to/naveenchandar/iife-in-javascript-1ob4</guid>
      <description>&lt;p&gt;Have you ever come across a function in JavaScript that's wrapped in parentheses and immediately executed? It might look strange at first, but it’s actually one of the most elegant patterns in JavaScript called as &lt;strong&gt;IIFE&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this blog post, we'll break down what IIFE means, why it's useful, and how you can use it in your codebase.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is an IIFE?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;IIFE&lt;/strong&gt; stands for &lt;strong&gt;Immediately Invoked Function Expression&lt;/strong&gt;. It’s a function that runs &lt;strong&gt;immediately after it is defined&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic Syntax
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;IIFE runs!&lt;/span&gt;&lt;span class="dl"&gt;"&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;You can also use an arrow function:&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="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arrow IIFE runs!&lt;/span&gt;&lt;span class="dl"&gt;"&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;h2&gt;
  
  
  Why Use an IIFE?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Avoid Global Scope Pollution&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Variables declared inside an IIFE can’t be accessed from the outside, keeping the global namespace clean.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Encapsulation&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;You can hide variables and functions from the outside world, which is great for creating private scopes.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Safe Initialization Code&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;IIFEs are often used for code that needs to run once and not leave any trace in the global scope.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-World Example
&lt;/h2&gt;

&lt;p&gt;Here’s a simple counter module using an IIFE:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;counter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&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;count&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;getCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;})();&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getCount&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;  &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;code&gt;count&lt;/code&gt; variable is private. Only the returned methods can interact with it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Types of IIFE
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Traditional Function IIFE
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Traditional IIFE&lt;/span&gt;&lt;span class="dl"&gt;"&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;h3&gt;
  
  
  Arrow Function IIFE
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arrow IIFE&lt;/span&gt;&lt;span class="dl"&gt;"&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;h2&gt;
  
  
  IIFE in a React Component
&lt;/h2&gt;

&lt;p&gt;You might not use IIFE very often in React, but here’s a useful scenario: &lt;strong&gt;rendering logic that should execute immediately inside JSX&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  JSX Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;UserGreeting&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;isLoggedIn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Welcome back, &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Please sign in.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;})()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;UserGreeting&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the IIFE is used inside JSX to conditionally render different outputs using more complex logic than what a ternary operator might allow.&lt;/p&gt;




&lt;h3&gt;
  
  
  Async IIFE Inside &lt;code&gt;useEffect&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;A common React pattern is making API calls inside &lt;code&gt;useEffect&lt;/code&gt;. Since &lt;code&gt;useEffect&lt;/code&gt; doesn't accept async functions directly, developers often define an inner async function and then call it. Instead, you can use an IIFE:&lt;/p&gt;

&lt;h4&gt;
  
  
  Traditional Approach
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchApiCall&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apiurl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nf"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;setError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nf"&gt;fetchApiCall&lt;/span&gt;&lt;span class="p"&gt;();&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;h4&gt;
  
  
  Using IIFE
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apiurl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nf"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;setError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;})();&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;h3&gt;
  
  
  ✅ Why Use an IIFE Here?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Avoids having to separately define and call an inner function&lt;/li&gt;
&lt;li&gt;Keeps the logic compact and scoped inside &lt;code&gt;useEffect&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Looks cleaner, especially for short one-off fetch operations&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Common Use Cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Wrapping library or plugin code&lt;/li&gt;
&lt;li&gt;Avoiding variable conflicts&lt;/li&gt;
&lt;li&gt;Creating isolated scope in loops&lt;/li&gt;
&lt;li&gt;Polyfills&lt;/li&gt;
&lt;li&gt;Async functions in &lt;code&gt;useEffect&lt;/code&gt; (React)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  IIFE vs Modern Alternatives
&lt;/h2&gt;

&lt;p&gt;With the introduction of ES6, we now have better ways to manage scope:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Modules&lt;/strong&gt;: ES6 modules have their own scope.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Block Scope&lt;/strong&gt;: &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; allow block-level scoping.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Closures&lt;/strong&gt;: More powerful and flexible for state management.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even though these alternatives exist, understanding IIFEs is essential for reading legacy code and building a solid foundation in JavaScript.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;IIFE is a classic pattern in JavaScript that solves real problems like variable scope management and safe initialization. Even in the modern JS ecosystem, it remains a valuable concept to understand and appreciate.&lt;/p&gt;

&lt;p&gt;Next time you see a function wrapped in parentheses and immediately called, you’ll know exactly what's going on—and why it’s such a neat trick.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Bonus Tip&lt;/strong&gt;: Try converting some of your global-scope-heavy scripts into IIFEs and see the difference it makes in structure and readability.&lt;/p&gt;

&lt;p&gt;Feel free to share your thoughts or use-cases for IIFE in the comments below!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>frontend</category>
    </item>
    <item>
      <title>'This' in Javascript</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Fri, 14 Jan 2022 09:11:39 +0000</pubDate>
      <link>https://dev.to/naveenchandar/this-in-javascript-i84</link>
      <guid>https://dev.to/naveenchandar/this-in-javascript-i84</guid>
      <description>&lt;p&gt;If you're a javascript developer, definitely you would've come across a mystery keyword &lt;strong&gt;this&lt;/strong&gt;.&lt;/p&gt;

&lt;p&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%2Ftliginau5jrig9l70zus.jpeg" 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%2Ftliginau5jrig9l70zus.jpeg" alt="Javascript this" width="500" height="626"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The keyword &lt;strong&gt;this&lt;/strong&gt; can be major point of confusion, misery and general suffering in the life of a new JS developer.&lt;/p&gt;

&lt;p&gt;Today we're going to see how &lt;strong&gt;this&lt;/strong&gt; works in Javascript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic definition :&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;this&lt;/strong&gt; refers to the object that is executing the current function (current execution scope)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are 3 major use case scenarios where &lt;strong&gt;this&lt;/strong&gt; keyword will be used.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In functions&lt;/li&gt;
&lt;li&gt;Methods in objects and class&lt;/li&gt;
&lt;li&gt;Global&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It will be peculiar in each cases. Let's see it in detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. In functions
&lt;/h2&gt;

&lt;p&gt;Functions can be declared in different ways and most widely declared ways are function declarations and arrow functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Function Declarations :&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function normalFunction() {
    console.log('regular function', this); // window
}
normalFunction();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we try to call this function it will log the result of window i.e., global object which can be referred by &lt;strong&gt;this&lt;/strong&gt; in javascript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;this&lt;/strong&gt; will default to the global object, which is window in a browser and empty object in node.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function normalFunction() {
    'use strict';
    console.log('regular function', this); // undefined
}
normalFunction();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In strict mode, &lt;strong&gt;this&lt;/strong&gt; value is not set when entering an execution context, it remains as &lt;strong&gt;undefined&lt;/strong&gt;. Hence, it will log as &lt;strong&gt;undefined&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Arrow Functions :&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arrowFunction = () =&amp;gt; {
    console.log('arrow function', this); // window
}

arrowFunction();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Arrow functions don't have own version of &lt;strong&gt;this&lt;/strong&gt;. They will always inherit from the parent.&lt;/p&gt;

&lt;p&gt;What can we expect this to log? same as with normal functions, window or global object. Same result but with different reason. With normal functions the scope is bound to global object by default, arrows functions, as I said before, do not have their own &lt;strong&gt;this&lt;/strong&gt; but they inherit it from the parent scope, in this case the global one.&lt;/p&gt;

&lt;p&gt;What would happen if we add "use strict"?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arrowFunction = () =&amp;gt; {
    'use strict';
    console.log('arrow function', this); // window
}

arrowFunction();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing, it will log the same result, since the scope comes from the parent one.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Methods in objects and class
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Methods in objects :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whenever we are calling functions inside object, it is known as method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = {
    firstName: 'Naveen',
    lastName: 'chandar',
    normalFunction() {
        console.log('regular method',this); // user object
        return `${this.firstName} ${this.lastName}`;
    }
}
user.normalFunction(); //Naveen chandar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;what would it show in console ? window (based on explanations given above). But it will log as &lt;strong&gt;object user&lt;/strong&gt; itself because we're trying to access &lt;strong&gt;this&lt;/strong&gt; inside methods in object, it will refer the object itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip&lt;/strong&gt;: We should not see where &lt;strong&gt;this&lt;/strong&gt; has been declared, we should see how the current function has been invoked. If it is invoked without any parent (left to the dot) Eg.user, &lt;strong&gt;this&lt;/strong&gt; will be global object and if invoked with parent, it will scope to parent and returns the parent &lt;strong&gt;this&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;What happens if you're trying to call arrow functions as methods inside objects ?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = {
    firstName: 'Naveen',
    lastName: 'chandar',
    arrowFunction: () =&amp;gt; {
        console.log('arrow method',this); //window
        return `${this.firstName} ${this.lastName}`;
    }
}
user.normalFunction(); //undefined undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What's the result expected ? Naveen chandar ?. No, It will be &lt;strong&gt;undefined undefined&lt;/strong&gt;. As said earlier, Arrow functions doesn't has own &lt;strong&gt;this&lt;/strong&gt;. No matter where you call arrow functions, It will always inherit from parent scope and return the parent &lt;strong&gt;this&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this case, &lt;strong&gt;user&lt;/strong&gt; is the parent and user has access to global object by default, it logged the value of window and if you expand the window object, there won't be any &lt;strong&gt;firstName&lt;/strong&gt; or &lt;strong&gt;lastName&lt;/strong&gt; binded to that, it return as &lt;strong&gt;undefined undefined&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is why it's not recommended or not a good practice to write arrow functions as methods inside objects. But there are some rare scenarios where arrow functions will be helpful as methods.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Methods in class :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's see the same examples with classes. Classes are nothing but a template for creating objects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User {
    constructor(firstName, lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }
    normalFunction() {
        console.log(this); // User obj
        return `${this.firstName} ${this.lastName}`;
    }
}
const newUser = new User('naveen', 'chandar');
console.log(newUser.normalFunction()); // naveen chandar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If we are trying to access something with &lt;strong&gt;new&lt;/strong&gt; keyword, Javascript will create an empty object by default.&lt;/p&gt;

&lt;p&gt;The above code will give the result as expected, because of &lt;strong&gt;new&lt;/strong&gt; keyword, empty object will be created and binded to the User object.&lt;/p&gt;

&lt;p&gt;what happens if trying to use arrow functions as methods inside class ?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User {
    constructor(firstName, lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }
    arrowFunction = () =&amp;gt; {
        console.log(this); // User obj
        return `${this.firstName} ${this.lastName}`;
    }
}
const newUser = new User('naveen', 'chandar');
console.log(newUser.arrowFunction()); // naveen chandar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;what's the result expected ? ** undefined undefined **?&lt;br&gt;
No, It will return the same result as normal function. Because of lexical scoping.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;To summarise,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;this&lt;/strong&gt; refers to the object that is executing the current function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When used in global, &lt;strong&gt;this&lt;/strong&gt; refer to window itself.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In normal functions &lt;strong&gt;this&lt;/strong&gt; refers to how the function is invoked. (By default refers to global object).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Arrow functions will always inherit from the parent.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When used in object, &lt;strong&gt;this&lt;/strong&gt; refer to object itself for normal functions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When used in object, &lt;strong&gt;this&lt;/strong&gt; refer to global object for arrow functions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When used in class, &lt;strong&gt;this&lt;/strong&gt; refer to object itself for both normal functions and arrow functions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading this post. Hope, this post will make you understand how &lt;strong&gt;this&lt;/strong&gt; works in JS 😎.&lt;/p&gt;

&lt;p&gt;Let's meet on next post with another javascript concept.&lt;/p&gt;

&lt;p&gt;Have a great day 🙂.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>programming</category>
    </item>
    <item>
      <title>npm commands every developer should know</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Mon, 09 Aug 2021 09:40:09 +0000</pubDate>
      <link>https://dev.to/naveenchandar/npm-commands-every-developer-should-know-13dk</link>
      <guid>https://dev.to/naveenchandar/npm-commands-every-developer-should-know-13dk</guid>
      <description>&lt;p&gt;NPM stands for Node Package Manager, is one of the most used tools for any javascript developer. It puts all modules in one place so that node can find them, and manages dependency conflicts. Here's a list of the most common npm commands you should be aware of.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;install&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command is used to install the npm package and the other packages which the particular package depends on. It will install in the local &lt;code&gt;node_modules&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install &amp;lt;packagename&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There's a shorthand for installing the new packages.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i &amp;lt;packagename&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;uninstall&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command does the exact opposite of install. It will uninstall the package completely which is already exist in the node_modules folder. If the package mention is not present &lt;code&gt;package.json&lt;/code&gt; list or &lt;code&gt;node_modules&lt;/code&gt; folder, it won't do anything.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm uninstall &amp;lt;packagename&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Shorthand for uninstalling the new packages.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm un &amp;lt;packagename&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;update&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command updates the current package to the latest version and if no package name has been specified then it will update all packages. If some package is missing, it will check and update those too.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm update &amp;lt;packagename&amp;gt;&lt;/code&gt; or &lt;code&gt;npm update&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;Shorthand for updating the packages.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm up &amp;lt;packagename&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;deprecate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command will update the npm registry entry for a package by providing a deprecation warning or message to all who attempt to install it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm deprecate &amp;lt;pkg&amp;gt;[@&amp;lt;version range&amp;gt;] &amp;lt;message&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To un-deprecate a particular package, specify an empty string ("") for the message argument. Note that you must use double quotes with no space between them.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm deprecate &amp;lt;pkg&amp;gt;[@&amp;lt;version range&amp;gt;] ""&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;doctor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It checks our environment so that our npm installation has what it needs to manage our JavaScript packages. Before installing npm will check for some basic requirements which has to be met by the packages.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js and git must be executable by npm.&lt;/li&gt;
&lt;li&gt;Make sure the npm registry, registry.npmjs.com, or another service that uses the registry API is available.&lt;/li&gt;
&lt;li&gt;Directories that uses npm, node_modules (both locally and globally), exist and can be written by the current user.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm doctor&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;list&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command will print all the packages and their versions that are installed, as well as their dependencies in a tree structure.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm list&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;view&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command will prints the data about the package.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm view &amp;lt;packagename&amp;gt; &amp;lt;versions&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If version is not specified, default version is 'latest'&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;help&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command helps with the mentioned topic. It shows the appropriate documentation page.&lt;br&gt;
If the topic does not exist, or if multiple terms are provided, then npm will run the &lt;code&gt;help-search&lt;/code&gt; command to find a match. If &lt;code&gt;help-search&lt;/code&gt; finds a single subject, then it will run help on that topic, so unique matches are equivalent to specifying a topic name.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm help &amp;lt;term&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install/Update the package globally&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command will install or update the package globally in your local system.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install -g nodemon&lt;/code&gt;&lt;br&gt;
&lt;code&gt;npm update -g nodemon&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;-g specifes global. If &lt;code&gt;-g&lt;/code&gt; is not specified, package will be installed in local by default which can't be accessed outside the project directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install a package as production/development dependency&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command will install the package which will be available in the specified environment.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install -P &amp;lt;packagename&amp;gt;&lt;/code&gt; P for Production&lt;br&gt;
&lt;code&gt;npm install -D &amp;lt;packagename&amp;gt;&lt;/code&gt; D for Development&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;init&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command can convert an empty directory to an npm project by adding package.json file into it.&lt;/p&gt;

&lt;p&gt;Also, you can add meta info of the project to the &lt;code&gt;package.json&lt;/code&gt; file while creating it.&lt;/p&gt;

&lt;p&gt;If you don't have &lt;code&gt;package.json&lt;/code&gt; in a directory, and you trigger &lt;code&gt;npm install moduleName&lt;/code&gt; at that directory path then module will be installed globally.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm init&lt;/code&gt; or &lt;code&gt;npm init -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;build&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm build&lt;/code&gt; and &lt;code&gt;npm run build&lt;/code&gt; are entirely different.&lt;br&gt;
&lt;code&gt;npm run build&lt;/code&gt; - This command runs the build field from the package.json scripts field.&lt;br&gt;
&lt;code&gt;npm build&lt;/code&gt; - It is an internal command. If you run it you'll get: npm WARN build npm build called with no arguments. Did you mean to npm run-script build? You can read more on the documentation &lt;a href="https://docs.npmjs.com/cli/v6/commands/npm-build" rel="noopener noreferrer"&gt;npm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;start&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command runs a predefined command specified in the &lt;code&gt;start&lt;/code&gt; property available inside &lt;code&gt;scripts&lt;/code&gt; in the &lt;code&gt;package.json&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;stop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This command runs a predefined command specified in the &lt;code&gt;stop&lt;/code&gt; property available inside &lt;code&gt;scripts&lt;/code&gt; in the &lt;code&gt;package.json&lt;/code&gt; file. Unlike &lt;code&gt;start&lt;/code&gt;, there is no default script that will run if the &lt;code&gt;stop&lt;/code&gt; property is not defined&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm stop &amp;lt;filename&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading this post. Have a great day. 🙂&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>node</category>
      <category>npm</category>
    </item>
    <item>
      <title>HTML input attributes</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Fri, 30 Jul 2021 10:00:36 +0000</pubDate>
      <link>https://dev.to/naveenchandar/html-input-attributes-4g08</link>
      <guid>https://dev.to/naveenchandar/html-input-attributes-4g08</guid>
      <description>&lt;p&gt;HTML input attributes make the input elements more usable. These input attributes provide more information about the input elements. Today we are going to see the available attributes for input html element.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;name&lt;/strong&gt;&lt;br&gt;
This attribute specifies the unique name in order to identify the particular input element.&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;input type="text" name="name"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;value&lt;/strong&gt;&lt;br&gt;
This attribute specifies the initial value for the input element and user can change this value.&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;input type="text" name="firstname" value="Naveen"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;disabled&lt;/strong&gt;&lt;br&gt;
This attribute will disable the input element i.e., making the element non editable and unclickable. These values will not be sent while submitting the form.&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;input type="text" disabled&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;required&lt;/strong&gt;&lt;br&gt;
This attribute will check the input element whether it is filled or not. User must fill this input before submitting the form. This is simple validation without using javascript.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;&lt;br&gt;
This will only work for following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file.&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;input type="text" name="firstname" required&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;placeholder&lt;/strong&gt;&lt;br&gt;
The placeholder attribute works like a hint. It describes what to enter in the input field to user. It shows the text in grey fonts and once the user clicks on the input field it will be faded.&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;input type="text" placeholder='Enter your first name'&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;autofocus&lt;/strong&gt;&lt;br&gt;
As the name suggests it will automatically focus the input element on page load.&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;input type="text" name="username" autofocus&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;readonly&lt;/strong&gt;&lt;br&gt;
The readonly attribute displays the value (if the value is specified) but doesn’t allow user to change the value.&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;input type="email" name="email" readonly&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It cannot be modified but we can focus it, highlight it, and copy the text from it.&lt;/p&gt;

&lt;p&gt;The value of a read-only input field will be sent when submitting the form.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;size&lt;/strong&gt;&lt;br&gt;
This attribute represents the number of characters to show. It defines the visual length of input field. Default value is 20.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;:&lt;br&gt;
This attribute works with the following input types: text, search, tel, url, email, and password.&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;input type="text" name="username" size="50"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;height and width&lt;/strong&gt;&lt;br&gt;
These attributes indicates the height and width of an HTML input element. This attribute is used only for input type image.&lt;br&gt;
Without setting these attributes, when page loads browser will not know how much space is required for image and cannot allocate a separate space for it. Flickering may occur while loading image. If height and width are set, the particular space is reserved by the browser when page loads.&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;input type="image" src="img.png" alt="cover picture" width="48" height="48"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;maxlength&lt;/strong&gt;&lt;br&gt;
This attribute specifies the maximum number of characters can be entered in the input field.&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;input type="text" name="username" maxlength="10"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;min and max&lt;/strong&gt;&lt;br&gt;
These attributes specified the minimum input value and maximum input value available for the particular input field.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;&lt;br&gt;
This will only work for following input types: number, date, range, time, week and month.&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;input type="number" name="quantity" min="1" max="5"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;step&lt;/strong&gt;&lt;br&gt;
This attribute specifies the intervals of the legal input numbers.&lt;br&gt;
Example:&lt;br&gt;
if step="6", legal numbers that can be used are -6, 0, 6 etc.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;&lt;br&gt;
This will only work for following input types: number, range, date, datetime-local, month, time and week.&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;input type="number" name="points" step="3"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;list&lt;/strong&gt;&lt;br&gt;
This attribute specifies the input field with a list of default predefined options.&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;form&amp;gt;
  &amp;lt;input list="language"&amp;gt;
  &amp;lt;datalist id="language"&amp;gt;
    &amp;lt;option value="Javascript"&amp;gt;
    &amp;lt;option value="Python"&amp;gt;
    &amp;lt;option value="C"&amp;gt;
    &amp;lt;option value="C#"&amp;gt;
    &amp;lt;option value="C++"&amp;gt;
  &amp;lt;/datalist&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;multiple&lt;/strong&gt;&lt;br&gt;
This attribute specifies that the user is allowed to enter more than one value in an input field.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;&lt;br&gt;
It will work only with the following input types: email, and file.&lt;br&gt;
while selecting files, click ctrl and select multiple files.&lt;br&gt;
while entering email id values entervalues separated with comma.&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;input type="file" id="files" name="files" multiple&amp;gt;
&amp;lt;input type="email" id="emails" name="emails" multiple&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;autocomplete&lt;/strong&gt;&lt;br&gt;
This attribute specifies whether an input field should have autocomplete on or off.&lt;/p&gt;

&lt;p&gt;Autocomplete allows the browser to predict the value. When user starts to type in input field, the browser should display previous filled options to fill in the field.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;&lt;br&gt;
It works with form and the following input types: text, search, url, tel, email, password, datepickers, range, and color.&lt;br&gt;
By default this attribute will be on.&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;input type="email" id="email" name="email" autocomplete="off"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;accept&lt;/strong&gt;&lt;br&gt;
This attribute specifies what file types the user can pick from the file input dialog box.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt; &lt;br&gt;
This can only be used with &lt;code&gt;&amp;lt;input type="file"&amp;gt;&lt;/code&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;input type="file" id="img" name="img" accept="image/*"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you for reading this post. Have a great day 🙂&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Web Storage API</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Fri, 23 Jul 2021 09:14:09 +0000</pubDate>
      <link>https://dev.to/naveenchandar/web-storage-api-3d49</link>
      <guid>https://dev.to/naveenchandar/web-storage-api-3d49</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is Web Storage&lt;/strong&gt;&lt;br&gt;
Web storage is more secure, and large amounts of data can be stored locally within the user's browser, without affecting website performance.&lt;/p&gt;

&lt;p&gt;Web storage has two types of mechanisms. They are &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Session storage&lt;/li&gt;
&lt;li&gt;Local storage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Session Storage&lt;/strong&gt;&lt;br&gt;
Changes are available per tab. Changes made are saved and available for the current page until the tab is closed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local Storage&lt;/strong&gt;&lt;br&gt;
Changes are available until we explicitly delete it. It will be available in all tabs with the same origin. Even we close the browser or tab or reboot the OS, these changes will remain as it is.&lt;/p&gt;

&lt;p&gt;Methods and Properties available in both session storage and local storage are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set Item&lt;/li&gt;
&lt;li&gt;Get Item&lt;/li&gt;
&lt;li&gt;Remove Item&lt;/li&gt;
&lt;li&gt;Clear&lt;/li&gt;
&lt;li&gt;Key&lt;/li&gt;
&lt;li&gt;Length&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Set Item&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It takes two parameters &lt;code&gt;key&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window.localStorage.setItem('name', 'Dev Community');
window.sessionStorage.setItem('name', 'Dev Community');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where &lt;code&gt;name&lt;/code&gt; is the key and &lt;code&gt;Dev Community&lt;/code&gt; is the value. Also note that &lt;strong&gt;local storage and session storage can only store strings&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To store arrays or objects, you should convert them to strings.&lt;/p&gt;

&lt;p&gt;To do this, we can use the &lt;code&gt;JSON.stringify()&lt;/code&gt; method before storing to setItem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const person = {
    name: "Naveen Chandar",
    location: "India"
}
window.localStorage.setItem('user',JSON.stringify(person));
window.sessionStorage.setItem('user',JSON.stringify(person));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The stored item can be accessed in application tab in chrome developer tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get Item&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This method allows you to access the data stored in the browser’s localStorage/sessionStorage object.&lt;/p&gt;

&lt;p&gt;It accepts only one parameter, which is the key given while storing the value, and it returns the value as 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;window.localStorage.getItem('user');
window.sessionStorage.getItem('user');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This returns a string with value&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"{"name":"Naveen Chandar","location":"India"}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To use this value, you should convert it back to an object.&lt;/p&gt;

&lt;p&gt;To do this, we make use of the JSON.parse() method, which converts a JSON string into a JavaScript object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;JSON.parse(window.localStorage.getItem('user'));
JSON.parse(window.sessionStorage.getItem('user'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Remove Item&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This method removes the specified key from the storage if it exists. If there is no item associated with the given key, this method will do nothing.&lt;/p&gt;

&lt;p&gt;It accepts only one parameter, which is the key given while storing the value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window.localStorage.removeItem('user');
window.sessionStorage.removeItem('user');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Clear&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This method clears all items present in local storage.&lt;br&gt;
It doesn't accept parameters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window.localStorage.clear();
window.sessionStorage.clear();
```



**Key**

This method is used to get the key on a given position. It will be useful in situations where you need to loop through keys and allows you to pass a number or index to local/session storage to retrieve the name of the key.



```
window.localStorage.key(index);
window.sessionStorage.key(index);
```



**Length**

This property returns the number of data items stored in a given Storage object.



```
window.localStorage.length;
window.sessionStorage.length;
```



**Broswer Support**

It is HTML5 specification and it is supported in all major browsers including IE8. To check whether browser supports for local/session storage



```
if (typeof(Storage) !== "undefined") {
  // Code for localStorage/sessionStorage.
} else {
  // Sorry! No Web Storage support..
}
```



**Limitations**

* Do not store sensitive user information in local/session storage such as passwords etc.,
* It is not a alternative for a server based database as information is stored only on the browser (client side).

**Difference B/w session storage and local storage**

**Size**

Session storage size is **5MB** 
Local storage size is **5MB/10Mb**

**Accessiblity**

Session storage can be accessed only on same tab
Local storage can be accessed anywhere within browser tabs.(Not in Incognito mode).

**Storage Location**

Both session and local storage are stored in browser.

**Expiration Date**

Session storage will be expired once the tab is closed.
Local storage won't get expired unless removing it manually.

**When to use session storage and local storage ?**

Session storage - It should be used when you need to store something that changes frequently.
Local storage - It should be used for long term use where data won't get changed often.

Thank you for reading this post. Have a great day 🙂
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>angular</category>
      <category>webdev</category>
    </item>
    <item>
      <title>CSS Box Model</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Thu, 15 Jul 2021 08:45:54 +0000</pubDate>
      <link>https://dev.to/naveenchandar/css-box-model-4h6f</link>
      <guid>https://dev.to/naveenchandar/css-box-model-4h6f</guid>
      <description>&lt;p&gt;&lt;strong&gt;Everything in CSS is a box&lt;/strong&gt;. Yes I mean it. Understanding how the CSS Box Model works is therefore a core foundation of CSS.&lt;/p&gt;

&lt;p&gt;It is one of the essential concepts to build layouts and make things look the way you want them. In Today's post we will be covering some key topics such as &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Border&lt;/li&gt;
&lt;li&gt;Padding&lt;/li&gt;
&lt;li&gt;Margin&lt;/li&gt;
&lt;li&gt;Box sizing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every element in a css has box around it. whether its visible or not, but there's a box. You will be working with different elements such as paragraph, images, headings,buttons etc., everything has box around it. Being able to understand how these boxes work is important and use these properties to manipulate the boxes the way you want. It is crucial part of designing layouts.&lt;/p&gt;

&lt;p&gt;Each boxes consists of several properties with it. They are as mentioned below&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Content Box&lt;/li&gt;
&lt;li&gt;Border&lt;/li&gt;
&lt;li&gt;Padding&lt;/li&gt;
&lt;li&gt;Margin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Content Box&lt;/strong&gt;&lt;br&gt;
Before going through content box. There are two types of elements in HTML. They are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inline elements &lt;/li&gt;
&lt;li&gt;Block level elements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Inline elements&lt;/strong&gt;&lt;br&gt;
The name says it doesn't start with new line. This does not force the element to display in a separate line. It only only takes up as much width as necessary.&lt;br&gt;
Ex: &lt;code&gt;span&lt;/code&gt;, &lt;code&gt;input&lt;/code&gt;,&lt;code&gt;a&lt;/code&gt;,&lt;code&gt;button&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Block level elements&lt;/strong&gt;: &lt;br&gt;
This type of elements starts with new line. It occupies entire horizontal and vertical space as much as by default.&lt;br&gt;
Ex: &lt;code&gt;div&lt;/code&gt;,&lt;code&gt;headings&lt;/code&gt;,&lt;code&gt;paragraphs&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The content box is the center of the box model. This is where text, images, and other html elements appear in a web page. We use the &lt;code&gt;height&lt;/code&gt; and &lt;code&gt;width&lt;/code&gt; CSS properties to determine the size of the content area.&lt;/p&gt;

&lt;p&gt;By default, the size of a content area will be equal to the size of its elements. If you have a line of text, the box will be as long and as tall as the line of text.&lt;/p&gt;

&lt;p&gt;Using height and width properties, we can manipulate the elements layout which is visible inside the box model.&lt;br&gt;
Example:&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;p style="background: palegreen;"&amp;gt;
Hi, I'm Paragraph
&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&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%2Fd5awos18k74hdrdq8svu.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%2Fd5awos18k74hdrdq8svu.png" alt="Block element" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since &lt;code&gt;P&lt;/code&gt; is block level element. So by default it takes the entire space by default as shown above.&lt;br&gt;
In order to change the layout of this, we need to change the height and width of the element.&lt;/p&gt;

&lt;p&gt;Suppose we want to design a paragraph element that is &lt;code&gt;100px&lt;/code&gt; of height and width. We can achieve by changing the height and width of particular element.&lt;br&gt;
Ex:&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;p style="height: 100px;width: 100px;background: palegreen;"&amp;gt;
Hi, I'm Paragraph
&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&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%2Fa5ukt0c0py13gu36cxmu.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%2Fa5ukt0c0py13gu36cxmu.png" alt="paragraph" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you look at the above image, the layout of the element has been changed. If you see the content box, it shows &lt;code&gt;100 * 100&lt;/code&gt; which is nothing but &lt;code&gt;width * height&lt;/code&gt;. Before applying the styles, by default according to the screen layout these sizes are chosen.&lt;/p&gt;

&lt;p&gt;When we try to change height and width of block elements, I've changed using &lt;code&gt;px&lt;/code&gt; but we have lot of different units available. In order to know more about units, please refer this &lt;a href="https://www.w3schools.com/cssref/css_units.asp" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But if we try to change the layout of inline elements,&lt;br&gt;
Example&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;span style="height: 120px;width: 500px;background: palegreen;"&amp;gt;
Hi, I'm Span
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&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%2F6jnewc63xy3dbrdhirdy.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%2F6jnewc63xy3dbrdhirdy.png" alt="Inline elements" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that size has not been varied, because for &lt;strong&gt;inline elements applying height and width styles won't work&lt;/strong&gt; and to make them work we need to change the display style of these elements in to &lt;code&gt;inline-block&lt;/code&gt; elements.&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;span style="height: 120px;width: 500px;background: palegreen;display: inline-block;"&amp;gt;
Hi, I'm Span
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&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%2Fz3sizsdstnhbelmz4tfh.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%2Fz3sizsdstnhbelmz4tfh.png" alt="Inline Block" width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By adding &lt;code&gt;display:inline-block&lt;/code&gt; style property to inline elements we are making them to behave as combination of both &lt;code&gt;inline&lt;/code&gt; and &lt;code&gt;block&lt;/code&gt; elements. (By default we don't want to mention the display property unless we want to change the height and width of inline elements).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Image elements are inline element by default&lt;/strong&gt; but its a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Replaced_element" rel="noopener noreferrer"&gt;replaced elements&lt;/a&gt;. So it behaves both as &lt;code&gt;inline&lt;/code&gt; as  well as &lt;code&gt;inline-block&lt;/code&gt;. You can set height and width to change the size &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#styling_with_css" rel="noopener noreferrer"&gt;MDN&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Border&lt;/strong&gt;&lt;br&gt;
The name explains that it applies border to specific elements.The border that goes around the content of a box, or around the padding of a box if a padding value is specified.&lt;br&gt;
Commonly we use a shorthand property for border which sets width,style and color for element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;border: 1px solid red;
1px -&amp;gt; border-width
solid -&amp;gt; border-style
red -&amp;gt; border-color.

&amp;lt;span style="height: 120px;width: 500px;background: palegreen;display: inline-block;border: 10px solid red;"&amp;gt;
Hi, I'm Span
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&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%2F95s4u6s2mnipqjjeqw83.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%2F95s4u6s2mnipqjjeqw83.png" alt="Border" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Border of &lt;code&gt;10px&lt;/code&gt; with red color has been applied to the element and if you look at the border in the box model it denotes 10 on each sides which represents &lt;code&gt;10px&lt;/code&gt; width. we can apply different colors for the same border too.&lt;br&gt;
We can change the radius of element using &lt;code&gt;border-radius&lt;/code&gt; property.&lt;br&gt;
You can set a separate width, color, radius styles on each sides of border.&lt;br&gt;
There are lot of border-style options available. Play through those options &lt;a href="https://www.w3schools.com/cssref/pr_border-style.asp" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Padding&lt;/strong&gt;&lt;br&gt;
The padding area is the space around the content area and within the border-box. A box that surrounds the html element's inner content. Because padding is inside the box, the background of the box will be visible in the space that it creates.&lt;br&gt;
We can apply padding to either one side or to all the sides.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Naveenchandar/embed/gOWmwaB?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;If you look at the above example image, there's a space between border and the content. That's padding.&lt;/p&gt;

&lt;p&gt;This is a shorthand for writing padding. It applies &lt;code&gt;10px&lt;/code&gt; padding on all the sides starting from top(clockwise direction).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;padding: 10px;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If all the sides are same then definitely you can use the shorthand property. If needed you can increase either one of the sides too and the space between the content and border for that particular side will alone increase.&lt;/p&gt;

&lt;p&gt;There's another shorthand for padding.&lt;br&gt;
&lt;code&gt;padding: 10px 20px&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If padding top and bottom are same and padding left and right are same then we can describe it as mentioned above where as first one represents top and bottom and latter one represents left and right.&lt;/p&gt;

&lt;p&gt;If left and right are same but top and bottom are different, then there's another shorthand to use is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;padding: 5px 10px 7px
5px -&amp;gt; padding top.
10px -&amp;gt; padding left and padding right.
7px -&amp;gt; padding bottom.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Margin&lt;/strong&gt;&lt;br&gt;
This is the outermost layer of the box model. This area creates an empty gap that separates one element from other on the web page.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Naveenchandar/embed/mdmWrEG?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The above example will create a &lt;code&gt;10px&lt;/code&gt; space between two boxes on a page. Same as padding, you can apply margin either on all four sides or one side. It follows the same clockwise direction. &lt;strong&gt;Difference between padding and margin is padding will occupy the space within content box and margin occurs outside the content box&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By default some elements has margins/padding based on certain browsers. You can change those properties too. So the common and most followed way is to reset these properties in order to display same across all the browsers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body{
  padding: 0
  margin: 0
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Box sizing&lt;/strong&gt;&lt;br&gt;
This property defines how the element width and height can be calculated, whether to include border and padding or not.&lt;br&gt;
By default,the height and width applied will be applied to element's content box. If any element has padding/border then the height and width of element changes. If the one element height/width changes then based on this, adjacent elements will be changed because its taking more space than expected.&lt;/p&gt;

&lt;p&gt;It is often to set &lt;code&gt;box-sizing:border-box&lt;/code&gt; to layout elements to avoid the overflow of elements.&lt;/p&gt;

&lt;p&gt;Box-sizing property has list of values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;content-box&lt;/li&gt;
&lt;li&gt;border-box&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;content-box&lt;/strong&gt;&lt;br&gt;
This is the default box sizing property specified by the &lt;a href="https://drafts.csswg.org/css-sizing/#box-sizing" rel="noopener noreferrer"&gt;CSS standard&lt;/a&gt;. This property will include only the height and width of the element but does not include the padding/border/margin.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Naveenchandar/embed/oNWZzWE?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;From the above example, two &lt;code&gt;div&lt;/code&gt; elements will have different sizes because of padding applied to &lt;code&gt;div2&lt;/code&gt;. Since &lt;code&gt;box-sizing&lt;/code&gt; will set to &lt;code&gt;content-box&lt;/code&gt; by default (if not specified). Here, the height and width will be calculated by.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;width = width of the content&lt;br&gt;
    height = height of the content&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;border-box&lt;/strong&gt;&lt;br&gt;
Inorder to make them equal size, &lt;code&gt;border-box&lt;/code&gt; value of &lt;code&gt;box-sizing&lt;/code&gt; to the rescue. This property allows us to include the padding and border in an element's total width and height.&lt;br&gt;
If you set &lt;code&gt;box-sizing: border-box&lt;/code&gt; on an element, padding and border are included in the width and height.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Naveenchandar/embed/xxdqErX?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;If you look at the above example, &lt;code&gt;div2&lt;/code&gt; has a property of &lt;code&gt;box-sizing: border-box&lt;/code&gt;. By setting this property, padding which you have applied earlier will be counted along with height and width of actual element. Here the height and width will be calculated by&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;width = border + padding + width of the content&lt;br&gt;
   height = border + padding + width of the content&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The CSS box model is an integral component of design and one of the fundamentals of web development. This box model will enable you to better align elements with other elements and create more complex layouts. &lt;/p&gt;

&lt;p&gt;Thanks for reading this post and have a great day 🙂.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>html</category>
      <category>design</category>
    </item>
    <item>
      <title>Javascript Hoisting</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Tue, 06 Jul 2021 11:28:25 +0000</pubDate>
      <link>https://dev.to/naveenchandar/javascript-hoisting-2pde</link>
      <guid>https://dev.to/naveenchandar/javascript-hoisting-2pde</guid>
      <description>&lt;p&gt;Hoisting is one of the important concepts every javascript or its related frameworks developers should be familiar with. Ever wonder how function calls or variable access can be done even before declaring those. If that's so then, Welcome to &lt;strong&gt;Javascript Hoisting World!!!&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Hoisting?
&lt;/h2&gt;

&lt;p&gt;This is one of the most common interview questions in front end development and common answer will be &lt;br&gt;
All variable and function declarations are moved to top. &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%2Fi9u2iy58y617rsv82hve.jpg" 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%2Fi9u2iy58y617rsv82hve.jpg" alt="Hoisting" width="500" height="616"&gt;&lt;/a&gt;&lt;br&gt;
Really???😮&lt;br&gt;
&lt;strong&gt;Hoisting is not what you think!!!😕&lt;/strong&gt;&lt;br&gt;
Let us discuss and clarify everything regarding hoisting in today's post.&lt;/p&gt;
&lt;h2&gt;
  
  
  Misconception
&lt;/h2&gt;

&lt;p&gt;If you are trying to search and learn about hoisting, almost everywhere you will be seeing the same definition. May be that's beginner friendly but definitely that's not true. &lt;strong&gt;In JavaScript, Nothing will be moved&lt;/strong&gt;.&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%2F01d70rqq7q1b3x7cn4wv.jpg" 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%2F01d70rqq7q1b3x7cn4wv.jpg" alt="JavaScript Hoisting" width="525" height="475"&gt;&lt;/a&gt;&lt;br&gt;
Let's discuss in detail.&lt;/p&gt;

&lt;p&gt;Before we start, let us understand how our code will be executed in javascript engine.&lt;br&gt;
JavaScript engine runs through our code twice. First time (creation phase) - the engine goes through the code and allocates memory for the declarations of variables and functions. Second time(Execution phase) is where it actually executes our code by going through it line by line, doing the assignments, calling the functions and so on..&lt;/p&gt;
&lt;h2&gt;
  
  
  Variable Hoisting
&lt;/h2&gt;

&lt;p&gt;Variables are one of the fundamental blocks of any programming language, the way each language defines how we declare and interact with variables can make or break a programming language. Thus any developer needs to understand how to effectively work with variables and their properties.&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('myName',myName);
var myName = 'JavaScript';
console.log('myName',myName);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you look at the above example and when you try to run the code, it will not throw error. First one will be &lt;code&gt;undefined&lt;/code&gt; and second one will be &lt;code&gt;Javascript&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is because no matter how are declaring variables, Javascript will always go through these lifecycles to declare a variable,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Declaration&lt;/li&gt;
&lt;li&gt;Initialization&lt;/li&gt;
&lt;li&gt;Utilization.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So,&lt;br&gt;
According to this lifecycle, the above example code will be split into&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var myName -&amp;gt; Declaration
myName = 'JavaScript' -&amp;gt; Initialization
console.log('myName',myName); -&amp;gt; Utilization.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So,in the first run javascript will check for the declarations of variables/functions and allocates memory space. This is where all the variables will be declared with a default value &lt;code&gt;undefined&lt;/code&gt; and in the second run while running through all the code it will assign the actual value for it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Actual definition&lt;br&gt;
Javascript actually scans the code and takes all the variables and allocates separate memory space even before executing the code. Its just variable declarations are executed first, so they will be in reserved memory.&lt;/strong&gt; &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Hoisting" rel="noopener noreferrer"&gt;MDN&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After introduction of &lt;a href="https://262.ecma-international.org/6.0/" rel="noopener noreferrer"&gt;ES6&lt;/a&gt;, Variables in Javascript can be declared by three types: var,let and const.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Another misconception is variable declared using var is only hoisted and let and const are not hoisted.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But that's not true. As per definition all the variable and function declarations are hoisted. But &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; hoisted a bit different.&lt;code&gt;Let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are hoisted in block scope whereas &lt;code&gt;var&lt;/code&gt; is hoisted in global scope. (Scope is another important concept which we will discuss in future post).&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('myName',myName);
let myName = 'Javascript';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you run the above code, you will be getting an error&lt;br&gt;
&lt;em&gt;Uncaught ReferenceError: myName is not defined&lt;/em&gt;.&lt;br&gt;
It's not the same case when you declare variable using var.&lt;br&gt;
Wait how's that??🤔&lt;br&gt;
Here comes a term called &lt;strong&gt;Temporal Dead Zone(TDZ)&lt;/strong&gt;.&lt;br&gt;
We are already in a middle of understanding one sci-fi term hoisting, but here comes the another sci-fi term called Temporal Dead Zone 🙄.&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%2Ftfm3o2kelrifa0d3l8e6.jpg" 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%2Ftfm3o2kelrifa0d3l8e6.jpg" alt="Javascript-Hoisting" width="500" height="418"&gt;&lt;/a&gt;&lt;br&gt;
So, what exactly is Temporal Dead Zone?&lt;br&gt;
It is Time taken between declaring the variable(using &lt;code&gt;let&lt;/code&gt; or &lt;code&gt;const&lt;/code&gt;) and initializing the variable.&lt;br&gt;
Let's go to the same code and will see why it shows reference error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*
  let myName;
  //Beginning of the temporal dead zone
  console.log(firstname); // ReferenceError as accessed in the TDZ.
let myName = 'Javascript'; // Ending of the temporal dead zone
*/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usage of &lt;code&gt;Let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; is recommended because unlike &lt;code&gt;var&lt;/code&gt;, there’s no risk of variable leakage outside of the scope of execution unless if needed. To learn more about var,let and const declarations, Please refer this &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements#declarations" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Function Hoisting
&lt;/h2&gt;

&lt;p&gt;Functions are one of the fundamental building blocks in JavaScript.&lt;br&gt;
There are multiple ways to declare a function. Common ways to declare a functions are&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Function Declaration&lt;/li&gt;
&lt;li&gt;Function Expression&lt;/li&gt;
&lt;li&gt;Arrow Function&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Function Declaration&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;greetings();
function greetings(){
    console.log('Hello from dev community')
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you run this example it won't throw any error because greetings will be declared on the first run by javascript engine due to hoisting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;greetings();
function greetings(){
 console.log('First',message);
 var message = 'Hello from Dev Community';
 console.log('Second',message);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you run this code, first console will display &lt;code&gt;undefined&lt;/code&gt; because variables declared inside functions will be hoisted only top of the particular scope (code blocks). So the code will be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;greetings();
function greetings(){
 var message;
 console.log('First',message);
 message = 'Hello from Dev Community';
 console.log('Second',message);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Function Expression&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

var greetings = function hoisting() {
  console.log('Hello from function expression?');
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JavaScript returns a &lt;code&gt;TypeError&lt;/code&gt; because unlike function declaration, only the variable was hoisted. When variables declared with var are hoisted, they are given a default value of &lt;code&gt;undefined&lt;/code&gt;. JavaScript then throws an error because the value of the variable is not a function at that point of time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Arrow Functions&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

const greetings = () =&amp;gt; {
  console.log('Hello from arrow functions?');
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works same as function expression due to hoisting.When using arrow functions, or any other function expression, we must always define the function before we call it. Accessing variables before declaration is often a root cause of errors. To clarify&lt;/p&gt;

&lt;p&gt;Only &lt;strong&gt;function Declarations are hoisted&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Order Of Precedence
&lt;/h2&gt;

&lt;p&gt;Always &lt;strong&gt;function declarations are given high priority than variable declarations&lt;/strong&gt; as per &lt;a href="https://262.ecma-international.org/5.1/#sec-10.5" rel="noopener noreferrer"&gt;ECMAScript, section 10.5&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;var abc;
function abc(){}
console.log(typeof abc)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function abcd(){}
var abcd
console.log(typeof abcd)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you run the above code, no matter what order you declare it, javascript engine will always gives high priority to function declarations than variable declarations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Let’s summarise what we’ve learned&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hoisting is a process that declares variables and functions into memory space ahead of assignment and initialization within the given scope of execution.&lt;/li&gt;
&lt;li&gt;Only variable declarations and function declarations are hoisted.&lt;/li&gt;
&lt;li&gt;const and let will be hoisted but cannot be read or accessed before their initialization.&lt;/li&gt;
&lt;li&gt;function declarations are given high priority than variable declarations while hoisting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To avoid confusion of hoisting and issues, it’s better to declare variables and functions before accessing them. You’ll avoid plenty of bugs and undefined warnings filling your console.&lt;/p&gt;

&lt;p&gt;I hope this clarifies how hoisting works in JavaScript. It's definitely not a complicated one as it sounds, but it requires us to breakdown the different use cases and trying different scenarios to understand how things work under the hood.&lt;/p&gt;

&lt;p&gt;Thanks for reading this post. Have a great day🙂.&lt;br&gt;
Let's meet on the next post with another Javascript concept.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>angular</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Package.json File explained!!!</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Wed, 30 Jun 2021 12:32:06 +0000</pubDate>
      <link>https://dev.to/naveenchandar/package-json-file-explained-b94</link>
      <guid>https://dev.to/naveenchandar/package-json-file-explained-b94</guid>
      <description>&lt;p&gt;If you've been working on javascript or related framework projects then definitely you came across the file named package.json and we might be curious why this file is included in our projects and why it's needed 🤔.&lt;/p&gt;

&lt;p&gt;The main purpose of this file is to hold various metadata related to the project and it is used to give information to npm that allows to identify the project and its dependencies.&lt;/p&gt;

&lt;p&gt;To create a package.json file manually you need to run a command &lt;code&gt;npm init&lt;/code&gt; which will ask you a bunch of questions that is not compulsory. Just hit enter to complete those.You can change it later.&lt;br&gt;
If you do want to answer these questions then you can run a command &lt;code&gt;npm init -y&lt;/code&gt; which will create a file named package.json with the defaults.&lt;/p&gt;

&lt;p&gt;Let's see the list of available options which npm has given us to make in this file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;name&lt;/strong&gt;&lt;br&gt;
If you've been working on some projects in local and if planning to publish it. &lt;br&gt;
Two important things are name and versions. Both are required and it should be unique.&lt;br&gt;
Name represents the name of your project.&lt;br&gt;
There are some rules for defining names.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Must be less than or equal to 214 characters&lt;/li&gt;
&lt;li&gt;should not begin with dot (.) or underscore(_).&lt;/li&gt;
&lt;li&gt;should not have an uppercase letter in the name. &lt;/li&gt;
&lt;li&gt;package name must not contain any non-url-safe characters (since name ends up being part of a URL)
Please go through this &lt;a href="https://www.ietf.org/rfc/rfc2396.txt" rel="noopener noreferrer"&gt;link&lt;/a&gt; to find unsafe characters.&lt;/li&gt;
&lt;li&gt;If needed you can check the npm registry whether the name is available or not.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;version&lt;/strong&gt;&lt;br&gt;
This property defines the version of your project and it should follow &lt;a href="https://docs.npmjs.com/about-semantic-versioning" rel="noopener noreferrer"&gt;semantic versioning guidelines&lt;/a&gt;.&lt;br&gt;
Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"version": "1.0.0"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;description&lt;/strong&gt;&lt;br&gt;
This property is used to provide more information about the project and it helps people to discover your package as its listed in npm's search.&lt;br&gt;
Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"description": "A package to work with strings"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;keywords&lt;/strong&gt;&lt;br&gt;
It's an array of strings.Keywords related to your project. This helps people discover your package based on the keyword search.&lt;br&gt;
Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"keywords": [
  "react",
  "Javascript"
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;homepage&lt;/strong&gt;&lt;br&gt;
This property is used to provide landing page url of your project.&lt;br&gt;
Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"homepage": "https://github.com/owner/project#readme"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;license&lt;/strong&gt;&lt;br&gt;
This property denotes the type of license in your project, whether this package can be used by others without any restrictions.To know more about &lt;a href="https://spdx.org/licenses/" rel="noopener noreferrer"&gt;license&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bugs&lt;/strong&gt;&lt;br&gt;
This property is used to specify the project issue tracker and / or the email address to which issues should be reported. These will be helpful for people who encounter issues while using your package.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"bugs":{
  "url" : "https://github.com/owner/project/issues",
  "email" : "project@hostname.com"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;people fields: author, contributors&lt;/strong&gt;&lt;br&gt;
This property specifies the number of contributors involved in developing this project.&lt;br&gt;
Author is for single person and contributors is array of people.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"author": "abc@example.com https://www.abc.com/",
"contributors": [{
    "name": "example",
    "email": "example@example.com",
    "url": "https://www.example.com/#team"
}]
(email and url are optional).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;scripts&lt;/strong&gt;&lt;br&gt;
This property contains commands that run at various times in the lifecycle of your package. It takes object with key being scripts we can with (npm run ) with the various command we give in the values.The key is the lifecycle event, and the value is the command to run at that point.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts":{
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "lint": "eslint ./"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are mostly terminal commands which helps us to execute specific task used during development. Learn more about &lt;a href="https://docs.npmjs.com/cli/v7/using-npm/scripts" rel="noopener noreferrer"&gt;npm scripts&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;dependencies&lt;/strong&gt;&lt;br&gt;
This is one of the most important key in your file and the entire reason to use this file. All your dependencies used in this project(various npm libraries installed via CLI) are listed here. when package is installed as npm install , after installation it will automatically added under the dependencies key.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"dependencies": {
 "react": "^17.0.1",
 "react-router-dom": "^5.2.0",
 "compression": "~1.7.4"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note:&lt;br&gt;
~ and ^ you see in the dependency versions are notations for version ranges defined in &lt;a href="https://github.com/npm/node-semver" rel="noopener noreferrer"&gt;semver&lt;/a&gt; as it follows semantic versioning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;devDependencies&lt;/strong&gt;&lt;br&gt;
some packages are needed only for development and doesn't need for production. Those packages can be listed in this. An example would be eslint or nodemon. These are the packages we will be using while development.&lt;br&gt;
To install a package as devDependency run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev &amp;lt;packagename&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;private&lt;/strong&gt;&lt;br&gt;
This property is either true or false. If you set it to true, then npm will refuse to publish it.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"private": true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;engines&lt;/strong&gt;&lt;br&gt;
This property sets which versions of Node and other commands this project should work on.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"engines": {
  "node": "&amp;gt;= 6.0.0",
  "npm": "&amp;gt;= 3.0.0",
  "yarn": "^0.13.0"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;browserslist&lt;/strong&gt;&lt;br&gt;
This property specifies which browser (along with versions) you want to support your project. If you are using latest ES features we need make sure all browsers supports it or if not then fallback/polyfills is needed. It's referenced by Babel, Autoprefixer, and other tools. To add the polyfills and fallbacks needed to the browsers you target.&lt;br&gt;
You can check &lt;a href="https://caniuse.com/" rel="noopener noreferrer"&gt;here&lt;/a&gt; whether the latest features has been supported by browser or not.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"browserslist": {
    "production": [
      "&amp;gt;0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note:&lt;br&gt;
0.2% specifies that you want to support the browsers with at least 0.2% of global usage.&lt;br&gt;
not dead means exclude browsers without official support in the last 24 months.&lt;br&gt;
You can learn more about browserslist &lt;a href="https://github.com/browserslist/browserslist" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;main&lt;/strong&gt;&lt;br&gt;
This property specifies the entry point in your project. If someone installs your project and then uses &lt;code&gt;import something from 'something'&lt;/code&gt;, the file you named in this key will be the one gets imported.&lt;br&gt;
If nothing is specified, it will be set to index.js by default.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"main": "src/main.js"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This package.json file will be the heart of any javascript/node project.Not all properties will be applicable to your project but we can make use of these properties to achieve some powerful benefits. Understanding the role of package.json file is important part of javascript ecosystem and it will make you more insightful!!🙂.&lt;/p&gt;

&lt;p&gt;Thanks for reading this and have a great day 😃. &lt;br&gt;
Lets meet in the next post 😉.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>node</category>
      <category>angular</category>
    </item>
    <item>
      <title>VS Code keyboard shortcuts (windows)</title>
      <dc:creator>Naveenchandar</dc:creator>
      <pubDate>Sat, 26 Jun 2021 15:57:37 +0000</pubDate>
      <link>https://dev.to/naveenchandar/vs-code-keyboard-shortcuts-windows-455e</link>
      <guid>https://dev.to/naveenchandar/vs-code-keyboard-shortcuts-windows-455e</guid>
      <description>&lt;p&gt;Here's the list of vs code keyboard shortcuts.It will work both for workspace and separate folders.&lt;/p&gt;

&lt;p&gt;I have windows machine so I will be posting the list related to windows. Sorry mac users :(.&lt;/p&gt;

&lt;p&gt;There are lots of vs code inbuilt shortcuts available. If needed you can create a custom shortcuts too.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + b&lt;/strong&gt; (&lt;em&gt;Toggle sidebar&lt;/em&gt;) - It is used to toggle the sidebar and the editor workspace.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + p&lt;/strong&gt; (&lt;em&gt;Go to file&lt;/em&gt;) - If you are working on a larger applications and if the folder structure is vast then definitely searching for a particular file in the application will be cumbersome. During at that time this shortcut will be very handy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + `&lt;/strong&gt; (&lt;em&gt;Toggle Terminal&lt;/em&gt;) - It is used to toggle the vs code terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + `&lt;/strong&gt; (&lt;em&gt;New Terminal&lt;/em&gt;) - It is used to open new vs code terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + G&lt;/strong&gt; (&lt;em&gt;Go to line&lt;/em&gt;) - It is used to go to particular line number in the current file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + H&lt;/strong&gt; (&lt;em&gt;Replace&lt;/em&gt;) - Suppose your file is too long and if you are using global variable and there is in need of replacing the variable name in all the places of same file. This shortcut is used to find all the matched and replaces them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + F&lt;/strong&gt; (&lt;em&gt;Find&lt;/em&gt;) - It is used to find the search results. It may be a variable name or function name etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + F&lt;/strong&gt; (&lt;em&gt;Find&lt;/em&gt;) - It is used to search globally all over the projects for the search result.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;*&lt;em&gt;Ctrl + *&lt;/em&gt; (&lt;em&gt;Split Editor&lt;/em&gt;) - It is used to split the editor in to two. This will be very useful while comparing the changes in your files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Alt + uparrow/downarrow&lt;/strong&gt; (&lt;em&gt;Move code Up/Down&lt;/em&gt;) - It is used to move the selected code up/down from the current line.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + n&lt;/strong&gt; (&lt;em&gt;New file&lt;/em&gt;) - It is used to open new untitled file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + N&lt;/strong&gt; (&lt;em&gt;New window&lt;/em&gt;) - It is used to open entire new vs code window.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + o&lt;/strong&gt; (&lt;em&gt;open file&lt;/em&gt;) - It is used to open file present in your local system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + K + O&lt;/strong&gt; (&lt;em&gt;New folder&lt;/em&gt;) - It is used to open the entire new folder and this will replace the current folder in vs code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + w&lt;/strong&gt; (&lt;em&gt;close file&lt;/em&gt;) - It is used to close the editor focused file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Shift + alt + uparrow/downarrow&lt;/strong&gt; (&lt;em&gt;Copy code up/down&lt;/em&gt;) - It is used to copy the same selected code up/down from the current line.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + X&lt;/strong&gt; (&lt;em&gt;Show extensions&lt;/em&gt;) - It is used to open the extensions menu available in the sidebar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + E&lt;/strong&gt; (&lt;em&gt;View explorer&lt;/em&gt;) - It is used to open the current project with current file focused on the sidebar.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + ,&lt;/strong&gt; (&lt;em&gt;settings&lt;/em&gt;) - It is used to open the settings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + M&lt;/strong&gt; (&lt;em&gt;New file&lt;/em&gt;) - It is used to open the terminal with problems tab focused to check the errors and warnings in the current project.Just replace the 'M' to 'U' to focus the output tab.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + T&lt;/strong&gt; (&lt;em&gt;Re-open a Closed Editor&lt;/em&gt;) - It is used to open a recently closed file in your current project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + backspace&lt;/strong&gt; (&lt;em&gt;deletewordleft&lt;/em&gt;) - It is used to delete the entire word on the left while typing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + k, z&lt;/strong&gt; (&lt;em&gt;Toggle Zen mode&lt;/em&gt;) - It is used to open the zen mode i.e., without any distractions only the editor space will be focused.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + /&lt;/strong&gt; (&lt;em&gt;Toggle line comment&lt;/em&gt;) - It is used to toggle the specific line comment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Shift + alt + A&lt;/strong&gt; (&lt;em&gt;Toggle block comment&lt;/em&gt;) - It is used to toggle comments between the blocks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + [&lt;/strong&gt; (&lt;em&gt;Fold cell&lt;/em&gt;) - It is used to fold available code in between the blocks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + ]&lt;/strong&gt; (&lt;em&gt;Unfold cell&lt;/em&gt;) - It is used to unfold available code in between the blocks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Shift + alt + F&lt;/strong&gt; (&lt;em&gt;Format document&lt;/em&gt;) - It is used to format code in the current file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + k + f&lt;/strong&gt; (&lt;em&gt;Format selection&lt;/em&gt;) - It is used to format the selected code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ctrl + shift + c&lt;/strong&gt; (&lt;em&gt;Open windows terminal&lt;/em&gt;) - It is used to open the windows terminal instead of vs code terminal.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To create custom key bindings please check this &lt;a href="https://code.visualstudio.com/docs/getstarted/keybindings#_common-questions" rel="noopener noreferrer"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To see complete list of inbuilt keyboard shortcuts please go through this &lt;a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf" rel="noopener noreferrer"&gt;Link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is my first post. Apologize for my grammar mistakes if any and for my bad english. I will improve in my upcoming posts.&lt;/p&gt;

&lt;p&gt;Thanks guys for reading this post. See you guys in the next post with list of vscode extensions.&lt;/p&gt;

&lt;p&gt;Have a Great Day 😊!!!.&lt;/p&gt;

</description>
      <category>vscode</category>
    </item>
  </channel>
</rss>
