<?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: Pankaj Jangra</title>
    <description>The latest articles on DEV Community by Pankaj Jangra (@pankajjangra77).</description>
    <link>https://dev.to/pankajjangra77</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%2F690898%2Fbbded43e-69be-4035-98f5-aede9c0057c7.png</url>
      <title>DEV Community: Pankaj Jangra</title>
      <link>https://dev.to/pankajjangra77</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pankajjangra77"/>
    <language>en</language>
    <item>
      <title>All About Loops and Iterations in Javascript.</title>
      <dc:creator>Pankaj Jangra</dc:creator>
      <pubDate>Sun, 22 Aug 2021 06:52:40 +0000</pubDate>
      <link>https://dev.to/pankajjangra77/all-about-loops-and-iterations-in-javascript-4nd7</link>
      <guid>https://dev.to/pankajjangra77/all-about-loops-and-iterations-in-javascript-4nd7</guid>
      <description>&lt;h2&gt;
  
  
  Are you confused among different kinds of loops in Javascript? No worries, I am here to help you out. I will explain every kind of loop in Js in this blog post.
&lt;/h2&gt;

&lt;p&gt;So, lets get started....&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We need loops&lt;/strong&gt; when we want to perform some task repeatedly. Of course you don't want to write the same thing again and again.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Have some pity on your hands. So use loops if you want to save them :)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  1.For Loop:
&lt;/h3&gt;

&lt;p&gt;The for loop performs some task until a specified condition becomes &lt;code&gt;false&lt;/code&gt;.&lt;br&gt;
The &lt;code&gt;syntax&lt;/code&gt; of for loop is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for ([initialExpression];[conditionExpression]; [incrementExpression]){
  //code to be executed
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initially &lt;code&gt;initialExpression&lt;/code&gt; is executed and then if &lt;code&gt;conditionExpression&lt;/code&gt; return true, then only the code inside the for loop is executed.&lt;br&gt;
And then &lt;code&gt;incrementExpression&lt;/code&gt; is executed. It mostly increment or decrement the counter.&lt;br&gt;
If &lt;code&gt;conditionExpression&lt;/code&gt; returns true, the loop stops right there. &lt;/p&gt;
&lt;h2&gt;
  
  
  2. While Loop:
&lt;/h2&gt;

&lt;p&gt;The while loop runs until the specified condition returns &lt;code&gt;false&lt;/code&gt;.&lt;br&gt;
Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;while (condition) {
  // code to be executed
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Do...While Loop:
&lt;/h3&gt;

&lt;p&gt;The do...while loop runs until a specified condition returns false.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;do{
  // code to be executed
}
while (condition);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this loop, the piece of code inside &lt;code&gt;do&lt;/code&gt; block will always get executed atleast once.&lt;br&gt;
Then the &lt;code&gt;condition&lt;/code&gt; inside while is checked. If it returns &lt;code&gt;true&lt;/code&gt; the loop continues to run else the loop stops its execution.&lt;/p&gt;
&lt;h3&gt;
  
  
  4. For-In Loop:
&lt;/h3&gt;

&lt;p&gt;The for-in statement loops through the properties of an iterable  object.&lt;br&gt;
Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (variable in object){ 
  //do something
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It returns the &lt;code&gt;index&lt;/code&gt; of each value inside the object/array.&lt;br&gt;
For Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let myFriends = ['vinod','ramesh','arjun','vishal'];
 for(let elements in myFriends){
   console.log(elements);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output: 0 1 2 3 &lt;/p&gt;

&lt;h3&gt;
  
  
  4. For-Of Loop:
&lt;/h3&gt;

&lt;p&gt;The for-of statement loops through the properties of an iterable object.&lt;br&gt;
Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (variable of object){ 
  //do something
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It returns each &lt;code&gt;value&lt;/code&gt; present inside the object/array.&lt;br&gt;
For Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let myFriends = ['vinod','ramesh','arjun','vishal'];
 for(let elements of myFriends){
   console.log(elements);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output(each in new line): vinod ramesh arjun vishal &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This time we are getting values not indexes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thats all for now! I hope you enjoyed it reading. Any suggestions or improvements are welcomed.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>html</category>
    </item>
    <item>
      <title>All About Git and Github.</title>
      <dc:creator>Pankaj Jangra</dc:creator>
      <pubDate>Sun, 22 Aug 2021 04:59:09 +0000</pubDate>
      <link>https://dev.to/pankajjangra77/all-about-git-and-github-4ghm</link>
      <guid>https://dev.to/pankajjangra77/all-about-git-and-github-4ghm</guid>
      <description>&lt;h2&gt;
  
  
  Hey there! Are you confused between Git and Github and want to know more about it? Then give this blog a read. I will try to provide all the details about it.
&lt;/h2&gt;

&lt;p&gt;Let's get started....&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Git?
&lt;/h3&gt;

&lt;p&gt;Git is a version control system which is used for tracking changes in source code during software development process.&lt;br&gt;
It was first developed in 2005.&lt;br&gt;
Git is installed on your local machine so that you can use tools like Github, which uses the git mechanism.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is version control?
&lt;/h3&gt;

&lt;p&gt;Version control, as we can understand from the name itself, it is like controlling the versions of our project/software that we develop.&lt;br&gt;
We can track and log the changes that we have made. It gives us the power to review them and we can even go back to the earlier versions that we have saved.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is Github?
&lt;/h3&gt;

&lt;p&gt;We can say that Github is a cloud-based tool which uses Git's functionality and provides us the built-in version control system.&lt;br&gt;
We can share our code online on github, by making a repository on it. And also we can host our project on it by using its hosting service.&lt;/p&gt;
&lt;h3&gt;
  
  
  Commonly Used Git Commands
&lt;/h3&gt;
&lt;h4&gt;
  
  
  1. Git init
&lt;/h4&gt;

&lt;p&gt;This command is used to initialize an empty Git repository. This can be probably the first command you run in a newly created project.&lt;br&gt;
&lt;code&gt;cd&lt;/code&gt; into the folder and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Git status
&lt;/h4&gt;

&lt;p&gt;This is a very helpful command. Sometimes you forget where you are on your git repo. So just run this command, this will tell you a lot of things like: &lt;br&gt;
your current branch, what is committed, pushed or pulled, your branch is up to date or not and a lot more things.&lt;br&gt;
Syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Git add
&lt;/h4&gt;

&lt;p&gt;Whenever you make any change to file, create a new file or delete any file. You need to run this command. It will add the files to the staging area but it will not make any change in the remote repository.&lt;br&gt;
Syntax:&lt;br&gt;
To add a single file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add &amp;lt;filename&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To add all the files (the dot is mandatory at the end):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add . 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>git</category>
      <category>github</category>
      <category>versioncontrol</category>
    </item>
  </channel>
</rss>
