<?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: Mohit Sharma</title>
    <description>The latest articles on DEV Community by Mohit Sharma (@darklegend36).</description>
    <link>https://dev.to/darklegend36</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%2F694557%2F78027d68-39e2-4407-8dd3-7e08bb1dd0ad.jpg</url>
      <title>DEV Community: Mohit Sharma</title>
      <link>https://dev.to/darklegend36</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/darklegend36"/>
    <language>en</language>
    <item>
      <title>Guide To Var, Let and Const</title>
      <dc:creator>Mohit Sharma</dc:creator>
      <pubDate>Fri, 14 Oct 2022 14:10:03 +0000</pubDate>
      <link>https://dev.to/darklegend36/guide-to-var-let-and-const-4kn3</link>
      <guid>https://dev.to/darklegend36/guide-to-var-let-and-const-4kn3</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hey Everyone, Hope you all are doing good.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's been a while since i have uploaded anything. So, here I'm with another blog. Without any delay let's get started.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;So whenever we want to declare any variable in JavaScript we need to use any of these three var, let and const and most the beginner who just started learning JavaScript they might be confused that which one to use and What is the Difference between them.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  VAR :-
&lt;/h2&gt;

&lt;p&gt;Previously before ES6 all of us were using var for declaring variable. As we didn't had any other options then var. But using var is not considered as a good practice because of it's global scope (we'll come back to it later in this blog). &lt;/p&gt;

&lt;p&gt;one of key difference in three of them is that the VAR is hoisted (will talk about this topic in some other blog).&lt;/p&gt;

&lt;p&gt;What is Global Scope :-&lt;/p&gt;

&lt;p&gt;So, whenever we declare a variable with VAR it is globally Scoped. &lt;strong&gt;Global scope&lt;/strong&gt; means when a variable is not inside of any function of conditions like &lt;strong&gt;IF&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:-&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's suppose we have declared a variable using var (As shown below) and with the same name we have declared another variable using var as you can see in the picture below it doesn't throw any errors but instead it changed the value of the variable which we created at first with the second variable. &lt;/p&gt;

&lt;p&gt;so, while developing an app we might use the same names for the variable and we don't want the values to get changed or broke something in our codebase that's why it is not considered as a good practice using var for declaring variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var name = "Steve";
console.log(name);

var name = "Jason";
console.log(name);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4cB3QXxw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4227dt1ku0ggwp9h4tbr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4cB3QXxw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4227dt1ku0ggwp9h4tbr.png" alt="Var" width="119" height="92"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  LET :-
&lt;/h2&gt;

&lt;p&gt;When ES6 version out it had many new things in it which changed the JavaScript and took it to the whole another level.&lt;/p&gt;

&lt;p&gt;Let and Const were introduced in ES6 new and a secured way to declare a variable.&lt;/p&gt;

&lt;p&gt;When we declare any variable with Let it create either global or function/block scope (we'll discuss function scope or block scope).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Function/Block Scope?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So, When we declare some variable using Let inside of the a function the scope of that variable is function scope or in simple language the variable is only accessible inside of that function. We cannot access it outside of the function and vice verse in &lt;strong&gt;IF&lt;/strong&gt; conditions.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;So,let's understand LET with an example:- *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Suppose we created a variable with Let and in our codebase (As shown below) we declared some variable with the same name we have created previously with let. The console will throw error (As Shown Below).&lt;/p&gt;

&lt;p&gt;not only it is considered as a good practice but it will also gives developer a secure way to code as we won't be able to create the variable globally with the same name as we did previously which the Var doesn't support. &lt;/p&gt;

&lt;p&gt;The main key difference in Var and Let is that the scope of Let is global and Function/Block Scope and with Let declare it only once but we can reassign values to it as we want.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let name = "Steve";
console.log(name);

let name = "Jason";
console.log(name);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h2&gt;
  
  
  CONST :-
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The main Difference between Let and Const :-&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The variable which is declared with Let it can be Updated but it cannot be Redeclared. But in Const neither we can Redeclared it nor we can updated it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Every Developer suggests to declare any variable with const most of time instead of var and let. But that depends upon the scenario you are in.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to use Let and Const?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So, many of you if you are a beginner in JavaScript you must be thinking when use Let and Const.&lt;/p&gt;

&lt;p&gt;Here are some point through which you can know which one to use.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Are you going to re-assign any values to it use &lt;strong&gt;LET&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Variable is not needed to be re-assign any values to it use &lt;strong&gt;CONST&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;So, That's a Wrap I Hope You Learnt something new today from this blog and you understood the key differences between these three.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For any queries contact me on my &lt;a href="https://twitter.com/Darklegend36"&gt;twitter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Top 5 Mistakes Beginners Make While Starting Programming</title>
      <dc:creator>Mohit Sharma</dc:creator>
      <pubDate>Sun, 08 May 2022 13:34:22 +0000</pubDate>
      <link>https://dev.to/darklegend36/top-5-mistakes-beginners-make-while-starting-programming-2a27</link>
      <guid>https://dev.to/darklegend36/top-5-mistakes-beginners-make-while-starting-programming-2a27</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hey guys this is my second blog so every programmer goes through these stages while they are starting out on programming. I myself had also been through the same things during my frontend developer journey, I also made the same mistakes that every programmer does. So in this blog, I will be highlighting those mistakes with solutions to them. let's go straight to the blog hope you'll like it.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Consistency:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Consistency is one of the most important thing while you are learning anything be it programming or learning any other skills. Consistency comes from being in discipline, you don't have to spend 8 hours or 6 hours for learning skills in the beginning. Even if you just spend 30 mins or 1 hour for learning skills it's enough.&lt;/p&gt;

&lt;p&gt;So coming up with the solution to this problem is how you can be consistent.&lt;/p&gt;

&lt;p&gt;Solution:- Before doing anything just try to build habit of learning for less amount of time.&lt;/p&gt;

&lt;p&gt;Suppose you are learning a new language or new skill just try to give it 30 mins a day, then gradually increase the amount of time, as you started learning a skill continue doing it for 30 mins a day for at least  1 or 2 weeks and then gradually increase the time to 1 hour and in this way, you will be consistent and in discipline.&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;Stick to one language:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Many beginners miss this point as they try to learn or practice many languages one at a time and hence it's necessary to just stick to one language and master it rather than learning many languages one at a time and getting confused.&lt;/p&gt;

&lt;p&gt;There is a quote that says:&lt;br&gt;
"You must immerse yourself in your work. You have to fall in love with your work You must dedicate your life to mastering your skill. That’s the secret of success."&lt;/p&gt;

&lt;p&gt;Starting with the fundamentals all the programming language has the same fundamentals the difference is that every language has its own syntax but the fundamentals are the same.&lt;/p&gt;

&lt;p&gt;In beginning, you must always focus on polishing your fundamentals. If you are able to understand the fundamentals then after that, you can learn any language you want in no time.&lt;/p&gt;

&lt;p&gt;So the solution to this problem:&lt;br&gt;
Solution:- Pick a course in any programming language you want to learn. I'll suggest you start with C/C++ because it covers various topics as they are low-level languages. This means they do not have automatic memory management, So we have to do it manually which will inculcate the quality of a good programmer and logic building.&lt;/p&gt;

&lt;p&gt;3.&lt;strong&gt;Projects:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Building projects throughout your learning process is the most crucial part of the journey of every programmer which he/she should practice on a regular basis. Because building projects will help you to understand the topics in depth. Whenever you are learning any language like web development, if you have learned HTML &amp;amp; CSS you should build some landing pages, clone famous websites, and single-page websites this will clear all your doubts and questions regarding the topic. &lt;/p&gt;

&lt;p&gt;I also used to do the same while I was a beginner in my field. I was not building projects at all. I was just learning a particular topic and was moving towards the next topic which slowed my learning curve as my fundamentals were not clear. I had to go through the basics again and again where I wasted a lot of time but later I understood my mistakes and then I started working on them.&lt;/p&gt;

&lt;p&gt;The solution to this problem:&lt;/p&gt;

&lt;p&gt;Solution: If you are learning a language and you don't know where to get the problems to solve or projects to build go to google and type the questions for the particular topic. One must be very good at googling if you are stepping into the field of programming/development.&lt;/p&gt;

&lt;p&gt;example: If you are learning about if-else conditions or loops just go and search if condition questions for practice.&lt;/p&gt;

&lt;p&gt;This way you'll be able to clear your basics.&lt;/p&gt;

&lt;p&gt;4.&lt;strong&gt;Tutorial:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;The Tutorial loop I got stuck at this point when I was starting out. I was just watching the tutorial and not doing any problem at all I used to think that I understood this topic but when I came to solve the problems, I was totally blank because I've only learned them or I just watched the tutorials instead of practicing them. So don't get stuck in the tutorial loop, If you got stuck then you won't be able to learn at all.&lt;/p&gt;

&lt;p&gt;The solution to this problem:-&lt;/p&gt;

&lt;p&gt;Solution: When you learn about a particular topic make notes first and then when the tutorial ends just go and try to solve 2 or 3 problems not many problems one at a time in the beginning but just 2 or 3 will give you a clear understanding of the topic so you'll be able to understand it.&lt;/p&gt;

&lt;p&gt;5.&lt;strong&gt;Burn-outs:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;I used to get burn-outs a lot during the initial phase. You don't have to push your limits when you are starting out, just do it for a little amount of time and take some break. Because taking breaks in between and getting refreshed is very important. If you don't take any break in throughout your learning curve you will get burnout frequently and this eventually will lead us to leave a particular thing that we are doing. When I was a beginner, I used to sit and learn for many continuous hours which resulted in frequent burn-outs in a short span of time. &lt;/p&gt;

&lt;p&gt;I left many things in between because of burnout. Time management is one of the the important thing in order to tackle the burn-out problem.&lt;/p&gt;

&lt;p&gt;The solution to this problem:-&lt;/p&gt;

&lt;p&gt;Solution: Suppose you get burn-outs frequently you can take a break for a day or 2 and can come back but with the proper time management strategy. Suppose you are aiming to study for 4 hours you can divide time into blocks or you can simply follow&lt;br&gt;
Pomodoro technique in which you will be working for 1 hour and taking a 10 to 15 mins break and complete the 4 cycles and always reward yourself during the break. You can watch some videos as a reward or can eat something of your choice.&lt;/p&gt;

&lt;p&gt;That's it for this blog I tried my best to help you to avoid these mistakes for beginners. I hope you like it and it helps you in avoiding these major mistakes as I did.&lt;/p&gt;

&lt;p&gt;For any queries contact me on my Twitter.&lt;br&gt;
&lt;a href="https://twitter.com/Darklegend36"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

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