<?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: Srivastan</title>
    <description>The latest articles on DEV Community by Srivastan (@srivastan).</description>
    <link>https://dev.to/srivastan</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%2F578100%2Fb9540d00-07c8-4714-9f88-bf5c35dab260.jpeg</url>
      <title>DEV Community: Srivastan</title>
      <link>https://dev.to/srivastan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/srivastan"/>
    <language>en</language>
    <item>
      <title>Higher order Functions</title>
      <dc:creator>Srivastan</dc:creator>
      <pubDate>Sun, 11 Jul 2021 17:17:49 +0000</pubDate>
      <link>https://dev.to/srivastan/higher-order-functions-2omp</link>
      <guid>https://dev.to/srivastan/higher-order-functions-2omp</guid>
      <description>&lt;p&gt;So I was going through lot of YouTube videos on this topic...wich made me eventually find wtf is this concept ...is ..&lt;br&gt;
In javascript a function is nothing but an value, &lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Consider
&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 Myrollno(value){
       return  value
            }

   let outputvalue = Myrollno(21)

    So if we 
   console.log(outputvalue)

    Output :
       21
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Hmm...so what happens we pass function instead of a value to the function ....that's what Higher order functions are...&lt;/p&gt;

&lt;p&gt;Still not clear .. consider &lt;br&gt;
   the example below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    var filtered = [12,5,8,130] ;

    functionisAboveMyRange(value){
        return value &amp;gt;= 25;
     }

   filtered.filter(isAboveMyRange);

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

&lt;/div&gt;



&lt;p&gt;So 'filter' Function is called as an Higher order function ,the function we pass as Argument is called an callback function...&lt;/p&gt;

&lt;p&gt;Still having Doubts comment it &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>JavaScript Recursion</title>
      <dc:creator>Srivastan</dc:creator>
      <pubDate>Sun, 20 Jun 2021 13:57:02 +0000</pubDate>
      <link>https://dev.to/srivastan/javascript-recursion-5cdp</link>
      <guid>https://dev.to/srivastan/javascript-recursion-5cdp</guid>
      <description>&lt;p&gt;UnderStand Recursion ...Understand Recursion..Until you really UnderStand&lt;/p&gt;

&lt;p&gt;Recursion is nothing but an Function which is Calling itself until it Complete its Work ... So how do we Keep it  in Simple  terms to understand ... Let me Explain it by Code , So Consider a Scernario of Function calling itself from 10 to 1&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  var givenNumber = 10
  function CountDown(num){
      if(num === 0){
           return console.log('Done');
      }else{
           console.log(num)
      }  
           CountDown(num-1);
  }
  CountDown(givenNumber);

 OutPut:
    10
    9
    8
    7
    6
    5
    4
    3
    2
    1
 "Done"

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

&lt;/div&gt;



&lt;p&gt;So in the Above Code We See that , We call the Function like an mirror where it reflects its own Action on itself Until it Has&lt;br&gt;
Some Condition to Stop it  , Well This is it Recursion is ...&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>Switch in Javascript</title>
      <dc:creator>Srivastan</dc:creator>
      <pubDate>Sat, 12 Jun 2021 10:23:36 +0000</pubDate>
      <link>https://dev.to/srivastan/switch-in-javascript-2b48</link>
      <guid>https://dev.to/srivastan/switch-in-javascript-2b48</guid>
      <description>&lt;p&gt;So JavaScript has different parts to learn, switch is something in &lt;strong&gt;conditional&lt;/strong&gt; part , okay let's make some question's before we learn&lt;br&gt;
  1) what are Conditions ?&lt;br&gt;
  2) why its So important in Coding?&lt;br&gt;
  3) What are the types of Conditional Statements?&lt;br&gt;
  4) Why Switch?&lt;br&gt;
  5) When to use Switch ? &lt;br&gt;
So conditions are Basically an code which allow us to make &lt;br&gt;
something to 'happen or execute' when Something is going to be true or false ,&lt;br&gt;
consider a scenario of getting a new Internship , the company is going to have 'Set of Rules' to follow on selecting an candidate &lt;br&gt;
like ...&lt;br&gt;
        1)  candidate got a degree&lt;br&gt;
        2)  Candidate got experience in the domain&lt;br&gt;
        3)  blah...blah...&lt;br&gt;
and finally from god grace(if he is there ??) we will get an internship if all the conditions are true.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Conditions are Nothing but 'Set of Rules' &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;While Programing we need to tell the computer to check Something &lt;br&gt;
on Executing , We can say it in multiple ways to the Computer this is where the &lt;strong&gt;Conditional Statements&lt;/strong&gt; come in Role, the frequently used are :&lt;br&gt;
  1) if..else..&lt;br&gt;
  2) if..elseif..else..&lt;br&gt;
  3) Switch&lt;br&gt;
So if your  opening Google and Searching for Flowers Colour, and &lt;br&gt;
Google has to respond with based on the Search keyword , as developer how will you program ,&lt;br&gt;
 we Can use an if &amp;amp;&amp;amp; else if , lets see how it works &lt;br&gt;
let us assume that we will have 3 major types of searches initially Rose, Sunflower, Violet.&lt;/p&gt;

&lt;p&gt;lets code using if else if...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      ```
           if(flower == 'rose'){
                console.log("Roses are red");
              }else if(flower == 'violet'){
                     console.log("Violets are blue");
                    }else if(flower == 'Sunflower'){
                         console.log("Sunflower are yellow");
                       }else {
                     console.log("Please select the flower")
                               }
         ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So from the above Code you can see that there is Weird Structure of Code that goes in some degree , and if we continue this can make an unclean Code, So lets see what this will look with an Switch Conditional Statement....&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           var flower = "tulip";
   switch (flower){
    case "rose":
          console.log("Roses are red");
        break;
    case "violet":
          console.log("Violets are blue");
        break;
    case "sunflower":
          console.log("Sunflowers are yellow");
        break;
    default:
          console.log("Please select another flower");
      }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Wasn't easy As a Developer you Would Always Have a doubt when to use Switch Statement  , So as per my View We can use Switch Statement While we have an Specific Conditional Cases.&lt;/p&gt;

&lt;p&gt;This is it …Comment your opinions and Correct me if am Wrong..&lt;/p&gt;

</description>
      <category>javscript</category>
      <category>react</category>
      <category>frontenddeveloper</category>
    </item>
    <item>
      <title>for in &amp;&amp; for of Loops</title>
      <dc:creator>Srivastan</dc:creator>
      <pubDate>Sun, 06 Jun 2021 10:11:57 +0000</pubDate>
      <link>https://dev.to/srivastan/for-in-for-of-loops-43b1</link>
      <guid>https://dev.to/srivastan/for-in-for-of-loops-43b1</guid>
      <description>&lt;p&gt;So everyone is found of for loops , so the idea of Publishing this article is to make clear my understanding on for in &amp;amp;&amp;amp; for of loops,&lt;br&gt;
let us begin the story , When I was going through my basics on JavaScript  found an interesting concept called as For in Loop …hmm interesting why it is interesting ?? does it make magic , Yeah it actually, Does  consider an Object in an world like an car what &lt;/p&gt;

&lt;p&gt;var Car = { &lt;br&gt;
             Engine Type: Twin Cylinders , &lt;br&gt;
             Speaker System: Ac, &lt;br&gt;
             Color: Red&lt;br&gt;&lt;br&gt;
            }&lt;br&gt;
 so if you want to by an new Car and if you approach an Sales Robot and ask him what are the Properties of the Car is , and the developer Behind the Robot is Going to help him through , guess what an For in loop , So Wtf are you trying to say Lets apply the loop to the Object ,&lt;/p&gt;

&lt;p&gt;Var Car = {&lt;br&gt;
            EngineType: Twin Cylinders , &lt;br&gt;
            SpeakerSystem: Ac, &lt;br&gt;
            Color: Red&lt;br&gt;&lt;br&gt;
           }&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  for (const property in Car) {
      console.log(property);
     }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;OutPut: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"EngineType"&lt;br&gt;
"SpeakerSystem"&lt;br&gt;
"Color"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So What about an For in .. in an Array , Hmm... That's an 'A' Grader's  Question , So developer takes it as Challenge and Code them&lt;/p&gt;

&lt;p&gt;Consider an Array which a Mom gives you for items in an Fridge,&lt;br&gt;
    Var Fridge = ['Eggs', 'Cola', 'Abounded Cheese' ,'Chocolate'];&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;So if  Developer Applies an For in.. Loop on the array,
      for (const property in Fridge) {
              console.log(property);
          }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;OutPut :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"0"&lt;br&gt;
"1"&lt;br&gt;
"2"&lt;br&gt;
"3"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So its going to Give the Indexes of the items inside the Array fine, So the Title consists of Two topics , So yeah u guys Guessed it its just Lead for the Second one ('Weird Smile on My Face')...&lt;br&gt;
 So to find the items , We can use For of Loop....&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Lets Loop the question..('Looping is nothing but Copying and Pasting the Same Stuff...#Philoshper')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Consider an Array which a Mom gives you for items in an Fridge,&lt;br&gt;
    Var Fridge = ['Eggs', 'Cola', 'Abounded Cheese' ,'Chocolate'];&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;So if  Developer Applies an For of.. Loop on the array,
      for (const property of Fridge) {
              console.log(property);
          }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;OutPut : &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Eggs"&lt;br&gt;
"Cola"&lt;br&gt;
"Abounded Cheese"&lt;br&gt;
"Chocolate"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Basically the Moral of Story is  just an Simple grammar&lt;br&gt;
 'in'  Stands for indicate 'inclusion, location, or position' and &lt;br&gt;
 'of' Stands for  'expressing the relationship between a scale or &lt;br&gt;
  measure and a value'.&lt;/p&gt;

&lt;p&gt;So Basically What will Happen When the loops used for Array of Objects ?? &lt;/p&gt;

&lt;p&gt;Comment it Out ….&lt;/p&gt;

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