<?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>Forem: Passionate Coder</title>
    <description>The latest articles on Forem by Passionate Coder (@passionate_coder).</description>
    <link>https://forem.com/passionate_coder</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%2F599733%2Ff3dd0e8e-6b0e-49f4-8ca5-e5ed39c353f5.png</url>
      <title>Forem: Passionate Coder</title>
      <link>https://forem.com/passionate_coder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/passionate_coder"/>
    <language>en</language>
    <item>
      <title>List Rendering in React</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Sat, 05 Jun 2021 06:21:09 +0000</pubDate>
      <link>https://forem.com/passionate_coder/list-rendering-in-react-5dch</link>
      <guid>https://forem.com/passionate_coder/list-rendering-in-react-5dch</guid>
      <description>&lt;p&gt;&lt;strong&gt;Why we need List Rendering in React&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Whenever we need to render same type of components or elements multiple time (with different data) than we use List rendering to automate rendering&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to do List Rendering in React&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;Javascript map() operator  (Introduced in ES6) is used for List Rendering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reduces Line of code&lt;/li&gt;
&lt;li&gt;Automates Rendering&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;STATIC WAY : NOT EFFICIENT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fgd86idvlz7a9a2xaadvd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fgd86idvlz7a9a2xaadvd.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;USING MAP&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fqaqu2fabsadv23dfgrww.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fqaqu2fabsadv23dfgrww.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can follow me on my youtube videos channel.&lt;/p&gt;

&lt;p&gt;Videos in Hindi&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/TPcG1fg7_Yg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/KzpayhfZEfM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>React Interview Questions</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Tue, 01 Jun 2021 11:43:01 +0000</pubDate>
      <link>https://forem.com/passionate_coder/react-interview-questions-bhf</link>
      <guid>https://forem.com/passionate_coder/react-interview-questions-bhf</guid>
      <description>&lt;p&gt;&lt;strong&gt;1) What is React?&lt;/strong&gt;&lt;br&gt;
Ans :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React is an open-source frontend JavaScript library.&lt;/li&gt;
&lt;li&gt;Used for building user interfaces especially for single page applications.&lt;/li&gt;
&lt;li&gt;It is used to handle presentation layer for web and mobile apps.&lt;/li&gt;
&lt;li&gt;It was developed by Facebook in 2011.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;2) What is JSX in react?&lt;/strong&gt;&lt;br&gt;
Ans :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JSX stands for JavaScript XML.&lt;/li&gt;
&lt;li&gt;JSX allows us to write HTML elements in JavaScript&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;3) What is component in react?&lt;/strong&gt;&lt;br&gt;
Ans :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Components are main building block of react.&lt;/li&gt;
&lt;li&gt;Components are independent and reusable bits of code.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vLuHu4Wb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wxt5fqbfg0stxlfy23nr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vLuHu4Wb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wxt5fqbfg0stxlfy23nr.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) What are props in react?&lt;/strong&gt;&lt;br&gt;
Ans: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Props are properties of a component.&lt;/li&gt;
&lt;li&gt;Props are read only/ Immutable&lt;/li&gt;
&lt;li&gt;Makes component dynamic&lt;/li&gt;
&lt;li&gt;Data can be shared with the help of props.&lt;/li&gt;
&lt;li&gt;Props are arguments passed into React components.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t6PkJ8T9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tcrk77xuefltjhqwnkm0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t6PkJ8T9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tcrk77xuefltjhqwnkm0.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5) What is Fragments in React?&lt;/strong&gt;&lt;br&gt;
Ans :&lt;/p&gt;

&lt;p&gt;A common pattern in React is for a component to return multiple elements. Fragments let you group a list of children without adding extra nodes to the DOM.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--poHdewDG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/clyqw13dqsr60kucfed9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--poHdewDG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/clyqw13dqsr60kucfed9.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6) What are defaultProps in React?&lt;/strong&gt;&lt;br&gt;
Ans:&lt;/p&gt;

&lt;p&gt;defaultProps is a property in React component used to set default values for the props argument. It will be changed if the prop property is passed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J0PkCB6y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p97s08h9l8yhmm7yw4vl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J0PkCB6y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p97s08h9l8yhmm7yw4vl.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7) What is props.children in react?&lt;/strong&gt;&lt;br&gt;
Ans :&lt;br&gt;
props.children represents the content between the opening and the closing tags when&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8) What is Lifting State Up in React?&lt;/strong&gt;&lt;br&gt;
Ans : &lt;br&gt;
In React, sharing state is accomplished by moving it up to the closest common ancestor of the components that need it. This is called “lifting state up”. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9) Why fragments are better than container divs?&lt;/strong&gt;&lt;br&gt;
Ans :&lt;/p&gt;

&lt;p&gt;1) Reduces un-necessary adding of elements in DOM.&lt;br&gt;
2) Helps to keep html elements structure like in table&lt;/p&gt;

&lt;p&gt;If you like you can visit my YouTube videos&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10) What is reconciliation?&lt;/strong&gt;&lt;br&gt;
Ans :&lt;/p&gt;

&lt;p&gt;Reconciliation is the process through which React updates the DOM.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/9OtC5I6XyGY"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Positioning text on image/div using css position and transform properties</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Sun, 30 May 2021 14:02:35 +0000</pubDate>
      <link>https://forem.com/passionate_coder/positioning-text-on-images-div-using-css-postion-and-transform-properties-39hl</link>
      <guid>https://forem.com/passionate_coder/positioning-text-on-images-div-using-css-postion-and-transform-properties-39hl</guid>
      <description>&lt;p&gt;&lt;strong&gt;Use Case :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes we need to put some text on image/div on different positions. We can do this by using positions like below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Faktoddg9xwyi30q42ru2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Faktoddg9xwyi30q42ru2.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML&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;&amp;lt;div class="container"&amp;gt;
      &amp;lt;div class="top-left"&amp;gt;Top Left&amp;lt;/div&amp;gt;
      &amp;lt;div class="top-right"&amp;gt;Top Right&amp;lt;/div&amp;gt;
      &amp;lt;div class="center"&amp;gt;Center&amp;lt;/div&amp;gt;
      &amp;lt;div class="bottom-left"&amp;gt;Bottom Left&amp;lt;/div&amp;gt;
      &amp;lt;div class="bottom-right"&amp;gt;Bottom Right&amp;lt;/div&amp;gt;
 &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CSS&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;.container {
  font-size: 20px;
  color: red;
  font-weight: bold;    
  background-image: url("https://i.picsum.photos/id/1/200/300.jpg?hmac=jH5bDkLr6Tgy3oAg5khKCHeunZMHq0ehBZr6vGifPLY");
  background-size: cover;
  width: 500px;
  height: 500px;
  position: relative;
}

.top-left {
  position: absolute;
  top: 15px;
  left: 50px;
}

.top-right {
  position: absolute;
  top: 15px;
  right: 50px;
}

.bottom-left {
  position: absolute;
  bottom: 15px;
  left: 50px;
}

.bottom-right {
  position: absolute;
  bottom: 15px;
  right: 50px;
}

.center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading this. You can follow me on YouTube&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/w_xjs9WHg3E"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>::before / ::after in css</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Sat, 29 May 2021 15:14:06 +0000</pubDate>
      <link>https://forem.com/passionate_coder/before-after-in-css-2nm8</link>
      <guid>https://forem.com/passionate_coder/before-after-in-css-2nm8</guid>
      <description>&lt;p&gt;Insert some text/image etc before of after and after an element without adding html elments&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use case&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0Ej-ujVb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/msdv9ut5wbtuf9z4nnso.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0Ej-ujVb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/msdv9ut5wbtuf9z4nnso.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes we need to style element like above in such case we can use before and after like below&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;html&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;&amp;lt;p&amp;gt;This is paragraph&amp;lt;/p&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;css&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;p {
    display: flex;
    align-items: center;
  }

  p::before {
    content: "";
    margin-right: 10px;
    flex: 1;
    border-bottom: 1px solid #ccc;
  }

  p::after {
    margin-left: 10px;
    content: "";
    flex: 1;
    border-bottom: 1px solid #ccc;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading this if you have any other suggestions to do this better please comment below&lt;/p&gt;

&lt;p&gt;For react beginner you can follow me on youtube ( If you want )&lt;/p&gt;

&lt;p&gt;React/Javascript Videos (IN Hindi)  : &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/NKotnxP6wdk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Clean Code #1 : React, Javascript</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Fri, 30 Apr 2021 15:41:24 +0000</pubDate>
      <link>https://forem.com/passionate_coder/clean-code-1-react-javascript-494l</link>
      <guid>https://forem.com/passionate_coder/clean-code-1-react-javascript-494l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;lets say we have a object like below&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: 'Vijay',
  lastName: 'Singh'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; : firstName and lastName can be empty string or undefined or null.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fullName = user.firstName 
? ( user.lastName ? `${user.firstName} ${user.lastName}`: user.firstName) 
: user.lastName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using || Operator&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 fullName = `${user.firstName || '' } ${user.lastName || ''}`.trim()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/nV1woOzVvRQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Hoisting in Javascript</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Tue, 27 Apr 2021 08:53:05 +0000</pubDate>
      <link>https://forem.com/passionate_coder/hoisting-in-javascript-4f2b</link>
      <guid>https://forem.com/passionate_coder/hoisting-in-javascript-4f2b</guid>
      <description>&lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt; &lt;br&gt;
In JavaScript is a behavior in which a function or a variable can be used before declaration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Hoisting&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;Variable Hoisting : Only variable declared with var is hoisted (not let and const)&lt;/p&gt;

&lt;p&gt;Function Hoisting :  Only Simple functions is hoisted (not function expressions)&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/nsxnGWQcZWA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Use of for in loop</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Sat, 03 Apr 2021 12:27:05 +0000</pubDate>
      <link>https://forem.com/passionate_coder/use-of-for-in-loop-463j</link>
      <guid>https://forem.com/passionate_coder/use-of-for-in-loop-463j</guid>
      <description>&lt;p&gt;We have so many loops now in javascript to optimize our code and ignore using old for loop. One such case can be seen in below example.&lt;/p&gt;

&lt;p&gt;We have given two array and asked to achieve an object like below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const keys = ["name", "city","gender", "job"];
const values = ["Test User", "Pune", "Female", "Developer"];

Desired Output
{
    name:"Test User"
    city:"Pune"
    gender:"female"
    job:"Developer"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Using for loop:&lt;/em&gt;&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 obj = {}
for(let i = 0; i&amp;lt;keys.length; i++){
     obj[keys[i]] = values[i]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;using for in loop:&lt;/em&gt;&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 obj = {}
for(let i in keys) {
    obj[keys[i]] = values[i]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;using for in loop our code looks more clean and its less complex and more efficient&lt;/p&gt;

&lt;p&gt;I hope it will help someone&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/QWh3IWmy-7Y"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Template Literals in ES6</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Wed, 31 Mar 2021 15:41:10 +0000</pubDate>
      <link>https://forem.com/passionate_coder/template-literals-in-es6-d76</link>
      <guid>https://forem.com/passionate_coder/template-literals-in-es6-d76</guid>
      <description>&lt;p&gt;&lt;strong&gt;Uses/ Benefits&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1) Template literals are used to concatenate strings.&lt;br&gt;
2) Placeholders/variables can be easily interpolated with template literals.&lt;br&gt;
3) Makes code more readable and Clean&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to write&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;4) Strings or placeholders needs to be wrapped inside backtick&lt;br&gt;
5) variables needs to wrapped like ${variable}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usecases&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1) Display  : The sum of 10 and 15 is 25.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let a = 10;
let b = 15;

"The sum of "+a+" and "+b+" is "+(a+b) +"." // ES5
`The sum of ${a} and ${b} is ${a+b}` // ES6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2) Display :&lt;br&gt;
I am a Developer.&lt;br&gt;
I love to code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"I am a Developer.\nI love to code." // ES5
`I am a Developer. 
 I love to code.` // ES6 no need to use \n for new line. It will keep format same as written
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3) Display : Let's code together&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Let's code together"  // ES5
'Let\'s code together' // ES5
`Let\'s code together` // ES6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more information follow&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals"&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also watch this: &lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/s2KoIilZfWs"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>angular</category>
      <category>react</category>
    </item>
    <item>
      <title>Javascript Interview Questions : Optional chaining (?.)</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Wed, 24 Mar 2021 09:53:20 +0000</pubDate>
      <link>https://forem.com/passionate_coder/javascript-interview-questions-optional-chaining-57mn</link>
      <guid>https://forem.com/passionate_coder/javascript-interview-questions-optional-chaining-57mn</guid>
      <description>&lt;p&gt;&lt;strong&gt;1) What is chaining operator?&lt;/strong&gt;&lt;br&gt;
Ans ) According to MDN official docs, The optional chaining operator (?.) permits reading the value of a property located deep within a chain of connected objects without having to expressly validate that each reference in the chain is valid&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note :&lt;/em&gt;  The optional chaining ?. stops the evaluation if the value before ?. is undefined or null and returns undefined.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) In which version of Javascript optional chaining is intoduced?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ans ) ECMAScript 2020&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;lets we have one object like below&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 = {
  name: 'Test User',
  address: {
    city: 'mumbai',
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if we try to access user.address.city =&amp;gt; We will get mumbai but  if we access something like this&lt;/p&gt;

&lt;p&gt;user.jobtitle.name =&amp;gt; this will gives as error as jobtitle is not a property of user and we are trying to access name property of undefined so earliar to ?. operator we need to do something like below to avoid this kind of error&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(user.jobtitle &amp;amp;&amp;amp; user.jobtitle.name) {
   // code related to use of user.jobtitle.name
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code can be minimized like below with the help of ?. operator&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(user.jobtitle?.name) {
  // code related to use of user.jobtitle.name
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Official Documentation&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining"&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;checkout more such questions&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Eb6HXDGQoTI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Interview questions related to event bubbling in Javascript?</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Tue, 23 Mar 2021 15:39:19 +0000</pubDate>
      <link>https://forem.com/passionate_coder/interview-questions-related-to-event-bubbling-in-javascript-1efo</link>
      <guid>https://forem.com/passionate_coder/interview-questions-related-to-event-bubbling-in-javascript-1efo</guid>
      <description>&lt;p&gt;&lt;strong&gt;1) What is Event bubbling in Javascript. Give Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Event bubbling is the method of event propogation in which event travels from innermost element to the outermost parent element.&lt;/p&gt;

&lt;p&gt;Like if we have below structure&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;section&lt;/span&gt; &lt;span class="nx"&gt;onclick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;alert('section')&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;onclick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;alert('div')&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="nx"&gt;onclick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;alert('paragraph')&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
        &lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;paragraph&lt;/span&gt;
     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/section&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If click event of paragraph invoked it will call click handlers of all in below order&lt;/p&gt;

&lt;p&gt;p&amp;gt;div&amp;gt;section&lt;/p&gt;

&lt;p&gt;Event bubbling is also known as &lt;strong&gt;Event Propagation&lt;/strong&gt; or &lt;strong&gt;Event Delegation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;2) How can event bubbling can be stopped?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;stopPropagation()&lt;/strong&gt; method of javascript used for stopping event bubbling&lt;/p&gt;

&lt;p&gt;For more such videos you can check my channel&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Eb6HXDGQoTI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>JS Interview Problem : Create a new array by adding one element at the beginning and one element at the end of  an given array.</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Sun, 21 Mar 2021 08:24:22 +0000</pubDate>
      <link>https://forem.com/passionate_coder/js-interview-problem-add-one-element-at-the-beginning-of-an-array-and-one-element-at-the-end-of-an-array-1m65</link>
      <guid>https://forem.com/passionate_coder/js-interview-problem-add-one-element-at-the-beginning-of-an-array-and-one-element-at-the-end-of-an-array-1m65</guid>
      <description>&lt;p&gt;let arr = [3,5,6,1]&lt;br&gt;
Add 9 at the starting of arr and 19 at the end of arr using ES6.&lt;/p&gt;

&lt;p&gt;This is very common problem statement which can be asked in Interview. Now a days questions from ES6 or higher is being asked to test latest knowledge of developer.&lt;/p&gt;

&lt;p&gt;This Problem can be solved in one line with the help of javascript spread operator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Soluion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;let newArr = [9, ...arr, 19]&lt;/p&gt;

&lt;p&gt;I have this will help someone&lt;/p&gt;

&lt;p&gt;For more such question visit&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Eb6HXDGQoTI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>android</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Difference between let and var</title>
      <dc:creator>Passionate Coder</dc:creator>
      <pubDate>Sun, 21 Mar 2021 07:38:05 +0000</pubDate>
      <link>https://forem.com/passionate_coder/difference-between-let-and-var-4j8h</link>
      <guid>https://forem.com/passionate_coder/difference-between-let-and-var-4j8h</guid>
      <description>&lt;p&gt;So I am here with a problem statement which is being asked in interview many times.&lt;/p&gt;

&lt;p&gt;let a = 'some value'&lt;br&gt;
var b = 'some other value'&lt;/p&gt;

&lt;p&gt;what will the output of&lt;/p&gt;

&lt;p&gt;window.a and window.b&lt;/p&gt;

&lt;p&gt;So the answer is &lt;/p&gt;

&lt;p&gt;window.a will be undefined&lt;br&gt;
window.b = 'some other value'&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reason :&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;var creates properties of the window object when declared globally &lt;/p&gt;

&lt;p&gt;but let (same with const) does not create properties of the window object when declared globally&lt;/p&gt;

&lt;p&gt;Difference between var and let&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=e0QcsWWFXkc"&gt;https://www.youtube.com/watch?v=e0QcsWWFXkc&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this helped somebody and thank you for reading!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
