<?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: Pratyush Raj Singh</title>
    <description>The latest articles on DEV Community by Pratyush Raj Singh (@pratyushsawan).</description>
    <link>https://dev.to/pratyushsawan</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%2F391949%2Fd704b3fe-576b-4d99-90fe-9624c7ae792a.png</url>
      <title>DEV Community: Pratyush Raj Singh</title>
      <link>https://dev.to/pratyushsawan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pratyushsawan"/>
    <language>en</language>
    <item>
      <title>From JavaScript to TypeScript</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Thu, 07 Aug 2025 04:10:57 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/from-javascript-to-typescript-lel</link>
      <guid>https://dev.to/pratyushsawan/from-javascript-to-typescript-lel</guid>
      <description>&lt;p&gt;Let's talk about something fundamental that often trips people up when they're first diving into the world of front-end development, especially with REACT and Typescript: the difference between &lt;u&gt;.js&lt;/u&gt;, &lt;u&gt;.jsx&lt;/u&gt;, &lt;u&gt;.ts&lt;/u&gt;, and &lt;u&gt;.tsx&lt;/u&gt; file extensions.&lt;/p&gt;

&lt;p&gt;It seems like a small detail, but understanding this can save you from a lot of head-scratching and "why isn't this working?" moments.&lt;/p&gt;




&lt;h2&gt;
  
  
  From JavaScript to TypeScript: The Big Leap
&lt;/h2&gt;

&lt;p&gt;We all start with JavaScript, right? The language is flexible, dynamic, and gets the job done. But that flexibility can be a double -edged sword.&lt;/p&gt;

&lt;p&gt;Imagine you have a function that's supposed to add two numbers. In a .js file, you might write:&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;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&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="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&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;This works perfectly... until someone accidentally calls it like &lt;code&gt;add (5, "world")&lt;/code&gt;. JavaScript will happily return &lt;code&gt;"5world"&lt;/code&gt;, and you might not even know you have a bug until much later.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;TypeScript&lt;/strong&gt; comes in. By using a &lt;code&gt;.ts&lt;/code&gt; file, we introduce &lt;strong&gt;static typing&lt;/strong&gt;. We tell the code what to expect, and the compiler becomes our trusty assistant, catching mistakes before they ever become a problem (at runtime).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&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;Now, if you try to call &lt;code&gt;add(5, "world")&lt;/code&gt;, the TypeScript compiler will immediately throw an error. It's like having a spelling checker for your code logic. It's a game-changer for building robust, scalable applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  Adding JSX into the Mix
&lt;/h2&gt;

&lt;p&gt;Now, let's talk about building user interfaces, specifically with React. React uses something called &lt;strong&gt;JSX&lt;/strong&gt;, which is an elegant way to write HTML-like code directly within your JavaScript files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In a standard React app, your component files might use the &lt;code&gt;.js&lt;/code&gt; or &lt;code&gt;.jsx&lt;/code&gt; extension. The "x" in &lt;code&gt;.jsx&lt;/code&gt; was originally a clear signal to build tools that "hey, this file contains JSX!". &lt;strong&gt;Today, most modern setups can handle JSX in a &lt;code&gt;.js&lt;/code&gt; file, but the intention remains the same.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When you bring TypeScript into your React projects, you need a way to tell the TypeScript compiler to not only check the types but also correctly parse the JSX.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the job of the &lt;code&gt;.tsx&lt;/code&gt; file extension.&lt;/p&gt;

&lt;p&gt;Think of it this way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;.ts&lt;/code&gt; = Standard TypeScript code (type-safe logic)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;.tsx&lt;/code&gt; = TypeScript + JSX (type-safe React components).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In practice, this means your component files will be &lt;code&gt;.tsx&lt;/code&gt;, while your utility functions, API services, and other non-UI logic will live in &lt;code&gt;.ts&lt;/code&gt; files. This keeps your codebase organized and ensures that your components are just as type-safe as the rest of your application.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Choosing the right file extension isn't just about following conventions; it's about clarity and stability. It allows development tools to do their job effectively and, most importantly, it helps you and your team write more predictable and less error-prone code.&lt;/p&gt;

&lt;p&gt;So, the next time you see &lt;code&gt;.ts&lt;/code&gt; or &lt;code&gt;.tsx&lt;/code&gt;, you'll know it's not just another file type - it's a conscious choice for building more robus, maintainable, and reliable software.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What Ethereum Is?</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Sat, 22 Apr 2023 08:28:44 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/what-ethereum-is-36b8</link>
      <guid>https://dev.to/pratyushsawan/what-ethereum-is-36b8</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Hey, Do you know what Ethereum is?&lt;br&gt;
Ans.- Yeah who doesn't know about Ethereum in today's era? It's a cryptocurrency just like Bitcoin and other.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, that's the general answer that I got for that similar question.&lt;br&gt;
But, Here is the tweak, Ethereum is not a cryptocurrency it's a decentralized platform that provides a high degree of security. The cryptocurrency is ether which is used to run the platform of Ethereum.&lt;/p&gt;

&lt;p&gt;Ethereum offers several benefits for developing DApps, including the ability to create and execute smart contracts. Smart contracts automate processes, reduce the need for intermediaries, and increase transparency and efficiency.&lt;/p&gt;

&lt;p&gt;In addition, Ethereum has a large and active community of developers and users who are constantly innovating and creating new applications. This provides a wealth of knowledge and resources for developers, as well as a user base for applications to reach. Finally, Ethereum has a strong security model, with built-in measures to protect against common attacks such s denial-of-service (DoS) attacks, spam attacks, and more. This ensures that your applications are safe and secure on the platform.&lt;/p&gt;

&lt;p&gt;Blockchain technology and Ethereum, in particular, are revolutionizing the way companies approch business. Here are some real-world examples of how Ethereum is being used to crete innovative solutions are solve real-world problems:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Coca-Cola is using Ethereum to imporve supply chain managment, ensuring transections are tracked and verfied in real-time. Imagine every bottle of Coca-Cola you purchase being tracked from the moment it's created until it reached your hands!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Microsoft is using Ethereum to create decentralized identities for its users, giving them more privacy and security. Imagine having complete control over your digital indentity and being able to securely manage it in a way that's never been possible before.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JP Morgan is using Ethereum to create their own blockchain platform called Quorum, which allows for more secure and efficient transection processing. Imagine being able to conduct financial transections faster and with greater transparency than ever before.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ConsenSys is using Ethereum to create decentralized applications across various industries, from finance to energy. Their solution are aimed at reducing friction increasing efficiency, and creating more transparent and equitable systems. Imagine being able to intrect with companies and systems in a completely transpletely transparent and trustworthy way.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ubisoft is using Ethereum to create blockchain-based gaming experiences, where players can truly own their in-game assets and have complete control over them. Imagine owning virtual items that have real-world value and being able to transfer them to other players or sell them for actual money!&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These are just a few examples of the limitless potential of Ethereum and blockchain technology. By utilizing Ethereum, companies are able to create solutions that are more secure, efficient, and transparent than ever before, and we can expect to see more and more businesses jumping on board in the coming years. The future is looking bright for Ethereum and the blockchain revolution!&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>solidity</category>
    </item>
    <item>
      <title>How to Add CI/CD using Github Action in a Project.</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Sun, 09 Apr 2023 07:00:36 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/how-to-add-cicd-using-github-action-in-a-project-50a0</link>
      <guid>https://dev.to/pratyushsawan/how-to-add-cicd-using-github-action-in-a-project-50a0</guid>
      <description>&lt;p&gt;Developers Life is always need a shortcut. In my development journy I was using manual deployment of my own projects. That's very time taking and repetable work for me. Then I go through and search for the internet about CI/CD and I come to know that we can use Github action for automate our build and deploy process.&lt;br&gt;
Before this I done this work in these steps manually:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First Commit my code to github&lt;/li&gt;
&lt;li&gt;Then make a build in local&lt;/li&gt;
&lt;li&gt;Then finally run deploy command&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;so, By the help of Github action I skip the last two steps, I just have to only push my code to my github and rest of the work will manage by the Github Actions.&lt;/p&gt;

&lt;p&gt;In this blog I am writing a begginer guide to start with Github action implementation in your project.&lt;/p&gt;

&lt;p&gt;For making any github action you have to make a folder called &lt;code&gt;.github&lt;/code&gt; in your root directory. Inside that folder make a new folder and named it &lt;code&gt;workflows&lt;/code&gt;. Inside Workflows folder you can define your github action file using &lt;code&gt;.yml extension&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I make a file: .github/workflows/deploy.yml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: Gatsby Build and Firebase Deploy

on:
  push:
    branches:
      - main

jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Use Node.js
      uses: actions/setup-node@v2
      with:
        node-version: '16.x'

    - name: Install dependencies
      run: |
        yarn install

    - name: Build Gatsby project
      run: |
        yarn build

    - name: Deploy to Firebase Hosting
      uses: w9jds/firebase-action@v1.4.0
      with:
        args: deploy --only hosting --token ${{ secrets.FIREBASE_TOKEN }}

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

&lt;/div&gt;



&lt;p&gt;This workflow will trigger whenever there is a push to the &lt;br&gt;
&lt;code&gt;main branch&lt;/code&gt;. It checks out the code, installs the necessary dependencies, builds the Gatsby project, and then deploys the project to Firebase Hosting.&lt;/p&gt;

&lt;p&gt;Make sure to replace &lt;code&gt;${{ secrets.FIREBASE_TOKEN }}&lt;/code&gt; with your own Firebase token, which you can create in the Firebase console. You'll also need to make sure that your Firebase project is properly set up for hosting, and that the necessary Firebase CLI tools are installed.&lt;/p&gt;

</description>
      <category>githubactions</category>
      <category>gatsby</category>
      <category>firebase</category>
      <category>automation</category>
    </item>
    <item>
      <title>How to use Command Line Arguments in Node.js</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Tue, 07 Mar 2023 16:31:16 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/how-to-use-command-line-arguments-in-nodejs-16gc</link>
      <guid>https://dev.to/pratyushsawan/how-to-use-command-line-arguments-in-nodejs-16gc</guid>
      <description>&lt;p&gt;&lt;strong&gt;INPUT:&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 argument = process.argv

console.log(argument)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT:&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;node your_fileName 4 5

[
Node js path,
your file path,
'4',
'5'
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Host Multiple WordPress Websites on one Server.</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Sun, 30 Jan 2022 10:02:26 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/hosting-multiple-website-in-one-server-ika</link>
      <guid>https://dev.to/pratyushsawan/hosting-multiple-website-in-one-server-ika</guid>
      <description>&lt;p&gt;&lt;strong&gt;Pre-requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Digital Ocean Account&lt;/li&gt;
&lt;li&gt;AA Panel&lt;/li&gt;
&lt;li&gt;Nameserver Management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 1: Create a Digital Ocean Account.&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%2Fcpnihcrgilppjnbia0eg.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%2Fcpnihcrgilppjnbia0eg.png" alt=" " width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2: Make a Basic Droplet With Ubuntu OS (cost 5$/month).&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%2Fkswgkpmnnjbuvf9fs1zh.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%2Fkswgkpmnnjbuvf9fs1zh.png" alt=" " width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 3: Login into Droplet Console.&lt;/p&gt;

&lt;p&gt;Step 4: Install AA panel in the Droplet (Ubuntu)&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%2Fh8p1i79vlce4amxymht5.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%2Fh8p1i79vlce4amxymht5.png" alt=" " width="800" height="415"&gt;&lt;/a&gt;&lt;br&gt;
Click Here for &lt;a href="https://www.aapanel.com/index.html" rel="noopener noreferrer"&gt;AAPanel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 5: Save the URL and Login Credentials of AApanel that you got after installation done in console.&lt;/p&gt;

&lt;p&gt;Step 6: Visit the URL open AApanel console and login with Credential&lt;/p&gt;

&lt;p&gt;Step 7: After Login choose NGINX server and install the basic files like MySQL, php (7.1 is better)&lt;/p&gt;

&lt;p&gt;Step 8: Add Website using their domain name/subdomain name&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%2Fsbo6tpx2fcdu712ip6yp.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%2Fsbo6tpx2fcdu712ip6yp.png" alt=" " width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 9: Go to your domain Name provider add A record and target it to the Droplet ipv4 address.&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%2Fmi5m5gi8p2k0mk684cdb.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%2Fmi5m5gi8p2k0mk684cdb.png" alt=" " width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your hosted site will be ready within an hour. A welcome page shown to the particular Domain name what you add in your AA panel.&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%2Frpn90idukesj56kr0b6v.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%2Frpn90idukesj56kr0b6v.png" alt=" " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>digitalocean</category>
    </item>
    <item>
      <title>How to Add Swap Space on Ubuntu 18.04 +</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Mon, 21 Dec 2020 12:56:50 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/how-to-add-swap-space-on-ubuntu-18-04-53p</link>
      <guid>https://dev.to/pratyushsawan/how-to-add-swap-space-on-ubuntu-18-04-53p</guid>
      <description>&lt;h3&gt;
  
  
  What is a Swap?
&lt;/h3&gt;

&lt;p&gt;Swap is a space on a disk that is used when the amount of physical RAM memory is full. When a Linux system runs out of RAM, inactive pages are moved from the RAM to the swap space.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Swap Sapce can take the form of -&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A Dedicated Swap Partition or,&lt;/li&gt;
&lt;li&gt;A Swap File&lt;/li&gt;
&lt;/ol&gt; 

&lt;p&gt;Generally when running Ubuntu on a virtual machine, a &lt;em&gt;swap partition&lt;/em&gt; is not present, and the only option is to create a &lt;strong&gt;swap file&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can add Swap space using both of above option. There is no any pros and cons b/w them If your using Ubuntu in your laptop then you can add simply a swapfile or can make a special partition on your disk for swap both will work same.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But making swapfile is a handy method from making a speical partition for swap, You can change it's swap size any time without even rebooting your machine. &lt;/p&gt;

&lt;h3&gt;
  
  
  How Much Swap do I need?
&lt;/h3&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%2Fi%2F4z9qd87qomc2y2q8njrj.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%2Fi%2F4z9qd87qomc2y2q8njrj.png" alt="Alt Text" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Before You Begin
&lt;/h3&gt;

&lt;p&gt;Before continuing with this tutorial, check if your Ubuntu installation already has swap enabled by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo swapon ---show
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the output is empty, it means that your system does not have swap space enabled.&lt;/p&gt;

&lt;p&gt;Otherwise, if you get something like below, you already have swap enable on your machine.&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%2Fi%2Fdczi6m1q8vntj5luh56z.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%2Fi%2Fdczi6m1q8vntj5luh56z.png" alt="Alt Text" width="741" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Although possible, it is not common to have  multiple swap spaces on a single machine.&lt;/p&gt;
&lt;h2&gt;
  
  
  1. First We discuss How to add or modify a &lt;strong&gt;Swap Partiton&lt;/strong&gt;.
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Creating the Swap Partition&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Boot the Ubuntu install CD and choose the option to run Ubuntu now.&lt;/li&gt;
&lt;li&gt;Go to System -&amp;gt; GParted Partition Editor.&lt;/li&gt;
&lt;li&gt;Delete the swap Partition and, if there is nothing else in it, the extended partition that holds it.&lt;/li&gt;
&lt;li&gt;Decrease the size of you primary parition by the amount you want your new sawp to be.&lt;/li&gt;
&lt;li&gt;In the free space/unallocated space, choose new, type &lt;strong&gt;linux-swap&lt;/strong&gt; and you can name the partition 'Swap' if you want.&lt;/li&gt;
&lt;li&gt;Hit the "Apply" button to write the changes to disk.&lt;/li&gt;
&lt;li&gt;When Done, reboot back into your ubuntu.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Activating the Swap Partiton&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open Gparted from the Applicatin menu. If you have not installed gparted then simply install it.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt install gpart
&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;$ sudo apt install gparted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Right-Click on your Swap Partition and choose &lt;em&gt;Information&lt;/em&gt;. You should see the &lt;strong&gt;path&lt;/strong&gt; and &lt;strong&gt;UUID&lt;/strong&gt; listed there. Keep this open for further reference.&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%2Fi%2Fa791n37va4pqduxq02zv.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%2Fi%2Fa791n37va4pqduxq02zv.png" alt="Alt Text" width="780" height="517"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run sudo gedit /etc/fstab and the below code in it.You can either use the path or the UUID to tell Linux where  to find you swap partition. I recommend UUID because it'll stay constant even if you move the partition around or the disk somehow becomes sdb instead of sda or something like that. Make the appropriate edits and save the file.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;UUID=41e86209-3802-424b-9a9d-d7683142dab7 none swap sw 0 0&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;or this if you used path:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;/dev/sda2 none swap sw 0 0&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Your changes should look something like this if you used UUID&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%2Fi%2Fvnw2gnzryjd6cv305gmt.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%2Fi%2Fvnw2gnzryjd6cv305gmt.png" alt="Alt Text" width="800" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable the new swap partition with this command.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo swapon --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Confirm that the swap partition exists
&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%2Fi%2F955iwl7sqn4qdpzyr4zm.png" alt="Alt Text" width="800" height="275"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  2. How do I add &lt;strong&gt;Swap File&lt;/strong&gt;?
&lt;/h2&gt;

&lt;p&gt;The user you are logged in as must have sudo privileges to be able to activate swap. In this example, we will add 1G swap. If you want to add more swap, replace 1G with the size of the swap space you need.&lt;/p&gt;

&lt;p&gt;Perform the steps below to add swap space on Ubuntu 18.04.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start by Creating a file which will be used for swap:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo fallocate -l 1G /swapfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If *&lt;em&gt;fallocate **is not installed or you get an error message saying *fallocate failed: Operation not supported&lt;/em&gt; then use the following command to create the swap file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Only the root user should be able to write and read the swap file. Set the correct permissions by typing:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo chmod 600 /swapfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Use the &lt;strong&gt;mkswap&lt;/strong&gt; utility to set up a Linux swap area on the file:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkswap /swapfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Activate the swap file using the following command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo swapon /swapfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make the change permanent open the /etc/fstab file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo gedit /etc/fstab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and past the following line&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%2Fi%2Fhqgi6n91iq9rdvlr5vjq.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%2Fi%2Fhqgi6n91iq9rdvlr5vjq.png" alt="Alt Text" width="708" height="93"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify that the swap is active by using either the swapon or the  free command, as shown below
&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%2Fi%2Fs30irvf10jykdw66ifxl.png" alt="Alt Text" width="731" height="477"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  What is Swappiness and how do i Adjust it?
&lt;/h3&gt;

&lt;p&gt;Swappiness is a Linux kernel property that defines how often the system will use the swap space. Swappiness can have a value between 0 and 100. A low value will make the kernel to try to avoid swapping whenever possible, while a higher value will make the kernel to use the swap space more aggressively.&lt;/p&gt;

&lt;p&gt;The default swappiness value is 60. You can check the current swappiness value by typing the following command:&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%2Fi%2Fxvm0ofd0q3z5v382je9j.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%2Fi%2Fxvm0ofd0q3z5v382je9j.png" alt="Alt Text" width="747" height="176"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While the swappiness value of 60 is OK for most Linux systems, for production servers, you may need to set a lower value.&lt;/p&gt;

&lt;p&gt;For example, to set the swappiness value to 10, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo sysctl vm.swappiness=10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To make this parameter persistent across reboots, append the following line to the /etc/sysctl.conf file:&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%2Fi%2Fzouc49yulk8tr6m6j21f.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%2Fi%2Fzouc49yulk8tr6m6j21f.png" alt="Alt Text" width="743" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The optimal swappiness value depends on your system workload and how the memory is being used. You should adjust this parameter in small increments to find an optimal value.&lt;/p&gt;

&lt;h3&gt;
  
  
  Removing a Swap File
&lt;/h3&gt;

&lt;p&gt;To deactivate and remove the swap file, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start by deactivating the swap space  by typing
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo swapoff -v /swapfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Next, remove the swap file entry /swapfile swap swap defaults 0 0 form the /etc/fstab file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, remove the actual swapfile using the &lt;strong&gt;rm&lt;/strong&gt; command:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo rm /swpfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Best Visual Studio Code Extensions.</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Tue, 04 Aug 2020 15:00:56 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/best-visual-studio-code-extensions-58ef</link>
      <guid>https://dev.to/pratyushsawan/best-visual-studio-code-extensions-58ef</guid>
      <description>&lt;h1&gt;
  
  
  This is how I use the best efficiency of Vs Code. If you are using Vs Code as your IDE then this full blog is for you. It will help you to boost your productivity. Many of you know these extensions already but if you found some new extension that is helpful for you then please give me your reaction. And also if you know any other best extensions of Vs Code then also please suggest their name in the comment.
&lt;/h1&gt;




&lt;h2&gt;
  
  
  1:- vscode-icons
&lt;/h2&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%2Fi%2Ff14itetydl8g6wsk86sv.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%2Fi%2Ff14itetydl8g6wsk86sv.png" alt="vscode-icons ss" width="800" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It doesn't change anything in vs code setting. It just gives you a better visual experience. It shows file icons with bright and sharp colors.&lt;/li&gt;
&lt;li&gt;It makes very easy to find files and visualize the file and also the type of file.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2:- GitLens
&lt;/h2&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%2Fi%2F3oir1m8en8q6tmhkq3r8.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%2Fi%2F3oir1m8en8q6tmhkq3r8.png" alt="GitLens Ss" width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is the best Extension that I found helpful for working with Version Control(Git and Github). It will give a lot of feature form out of the box.&lt;/li&gt;
&lt;li&gt;The best feature of it's. It shows the recent commit message and associated author inside the code editor for the line which you are currently editing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3:- Auto Rename Tag
&lt;/h2&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%2Fi%2F95km4tn4fraca5k3xqbm.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%2Fi%2F95km4tn4fraca5k3xqbm.png" alt="Auto Rename Tag ss" width="792" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is a very small in size but a very useful extension for writing HTML documents.&lt;/li&gt;
&lt;li&gt;It will automatically change the end Tag If you change the starting tag.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4:- Live Server
&lt;/h2&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%2Fi%2Fbzgqsw8haiovjrp4o5sd.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%2Fi%2Fbzgqsw8haiovjrp4o5sd.png" alt="Live Server ss" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I use this extension a lot. If you woking on a web-project this will very helpful for you.&lt;/li&gt;
&lt;li&gt;It automatically updates the browser when you change something in your codeBase and saved.&lt;/li&gt;
&lt;li&gt;It also makes a server on the computer so, it will also use for server-side languages like Php and Node.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5:- Rainbow Brackets
&lt;/h2&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%2Fi%2Fgxaomkwj00k0l8fpgybh.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%2Fi%2Fgxaomkwj00k0l8fpgybh.png" alt="RainBow Brackets ss" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It will provide you a beautiful colored code-base and also readable for the humans.&lt;/li&gt;
&lt;li&gt;It is an amazing time sever.&lt;/li&gt;
&lt;li&gt;It will simply give color coordination for matching brackets.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  This is not the end of Extension list.
&lt;/h2&gt;

</description>
      <category>vscode</category>
      <category>webdev</category>
      <category>computerscience</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>How To Write a Good JavaScript Code</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Sun, 02 Aug 2020 06:59:42 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/how-to-write-a-good-javascript-code-10mc</link>
      <guid>https://dev.to/pratyushsawan/how-to-write-a-good-javascript-code-10mc</guid>
      <description>&lt;h3&gt;
  
  
  In this Blog, we gonna tell you the best way to write a javaScript code which I learned till my learning journey.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  So, I gonna discuss 5 points which I used to write my javaScript code and it is very helpful for me to read and update my previous codeBases. And these tips can also helpful for you. So, please read once if you are a JS developer or gonna be a JS developer.
&lt;/h3&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%2Fi%2Fmx6d8fpzn4em5qkzgvt4.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%2Fi%2Fmx6d8fpzn4em5qkzgvt4.png" alt="pretty js code" width="800" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. JavaScript is CaseSensitive
&lt;/h2&gt;

&lt;h3&gt;
  
  
  This means when You use your &lt;code&gt;Shift&lt;/code&gt; or &lt;code&gt;CapsLock&lt;/code&gt; keys it really matters. Unlike in &lt;strong&gt;HTML&lt;/strong&gt; and &lt;strong&gt;CSS&lt;/strong&gt; Where you can use UPPER and lowercase letters, But in JS the casing of the words matters.
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Example:-&lt;/strong&gt;&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;var&lt;/span&gt; &lt;span class="nx"&gt;greenDuck&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This Duck is Green&lt;/span&gt;&lt;span class="dl"&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;greenduck&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Above code will show an error&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;Uncaught ReferenceError: greenduck is not defined.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Use &lt;code&gt;camleCase&lt;/code&gt; Words
&lt;/h2&gt;

&lt;h3&gt;
  
  
  practice of writing phrases such that each word or abbreviation in the middle of the phrase begins with a capital letter, with no intervening spaces or punctuation. Common examples include "iPhone" and "eBay".
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//variable starts with a Lowercase letter&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;greenDuck&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//objects and classes start with UpperCase letter&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;//Constants are All-Caps&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;NAME&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. WhiteSpace Matters (for Human)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  JavaScript doesn't care about whiteSpaces but as a human, you should. So, use whiteSpaces in your code for make it more readable for humans. It is useful when you work with a team.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//With whiteSpaces(human readable)&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;date&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//without whiteSpaces (machine Readable difficult for humans)&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. End Each Statment with a SemiColon(;)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Technically javaScript doesn't care you use a semicolon or not except some specific situations. But if you do not use it then your code is difficult to be read for humans. So, Good practice is to use a semicolon at the end of your statement in your codebase.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Semicolon is just a matter of opinion
&lt;code&gt;Do What Works best for you&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Use Comments Liberally.
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// A single line comment starts with two slashes.&lt;/span&gt;

&lt;span class="cm"&gt;/* A multi-line comment
starts with a slash and an asterisk
and ends with an asterisk and a slash */&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  This is the end. if you found this blog post helpful then, please comment and give a reaction.
&lt;/h2&gt;

</description>
      <category>javascript</category>
      <category>todayilearned</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>The 5 Habits of Highly Productive Programmers</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Fri, 10 Jul 2020 06:36:52 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/the-7-habits-of-highly-productive-programmers-1h41</link>
      <guid>https://dev.to/pratyushsawan/the-7-habits-of-highly-productive-programmers-1h41</guid>
      <description>&lt;p&gt;⭐ &lt;em&gt;I always believe that a good developer is not only being a great programmer but also possessing great habits&lt;/em&gt;🤯.&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;What do you mean by &lt;code&gt;Productivity&lt;/code&gt;?&lt;/strong&gt;&lt;br&gt;
👉 The term productivity is defined as the amount of output you churn out compared to input.&lt;/p&gt;

&lt;p&gt;⭐ &lt;strong&gt;So why you should be &lt;code&gt;Productive&lt;/code&gt;?&lt;/strong&gt;🤔&lt;br&gt;
👉 Being a &lt;code&gt;Productive&lt;/code&gt; Programmer brings tons of pluses including higher pay, office benefits, increased popularity among peers, and internal Satisfaction🔥.&lt;/p&gt;




&lt;h3&gt;
  
  
  ⚠️THE MOST IMPORTANT THING TO BE PRODUCTIVE ⚠️
&lt;/h3&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     👇👇👇👇👇👇👇👇👇👇👇👇👇👇
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;⭐⭐LOVE ❤️ WHAT YOU ARE DOING⭐⭐&lt;/p&gt;

&lt;p&gt;👉Productivity gains come with time, so don’t expect to see massive productivity gains in the short term. So&lt;/p&gt;




&lt;h1&gt;
  
  
  Tips For Gaining Productivity:-
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Tip 1 :
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use your time to gain something related to your field&lt;/p&gt;&lt;/li&gt;
&lt;li&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%2Fi%2Fh885btn561ryd5w8ja7z.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%2Fi%2Fh885btn561ryd5w8ja7z.png" alt="Tip 1" width="751" height="574"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tip 2 :
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&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%2Fi%2Fsrm1215w9if5js8rp7oh.png" alt="Tip 2" width="749" height="569"&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tip 3 :
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&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%2Fi%2Fxw0z82mfllj94l8luplm.png" alt="Tip 3" width="751" height="467"&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tip 4 :
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&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%2Fi%2Fzlwlx1x89hg2637ghfqe.png" alt="Tip 4" width="750" height="568"&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tip 5 :
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&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%2Fi%2Fxi5mpebpjlnqqyv1tt8t.png" alt="Tip 5" width="749" height="541"&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What is NODE JS</title>
      <dc:creator>Pratyush Raj Singh</dc:creator>
      <pubDate>Mon, 06 Jul 2020 05:35:37 +0000</pubDate>
      <link>https://dev.to/pratyushsawan/what-is-node-js-gj6</link>
      <guid>https://dev.to/pratyushsawan/what-is-node-js-gj6</guid>
      <description>&lt;h1&gt;
  
  
  Top Companies Using Node Js:
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;NETFLIX&lt;/li&gt;
&lt;li&gt;UBER&lt;/li&gt;
&lt;li&gt;PAYPAL&lt;/li&gt;
&lt;li&gt;LINKEDIN&lt;/li&gt;
&lt;li&gt;AMAZON&lt;/li&gt;
&lt;li&gt;NASA&lt;/li&gt;
&lt;li&gt;WALMART&lt;/li&gt;
&lt;li&gt;EBAY&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  What is NODE JS?
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;First of all, NODE is NOT(I repeat is NOT) a &lt;code&gt;FRAMEWORK&lt;/code&gt; or a &lt;code&gt;PROGRAMMING LANGUAGE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;NODE JS&lt;/code&gt; is a JAVASCRIPT RUNTIME ENVIRONMENT and it was introduced by Ryan Dahl in  2009. He used the Chrome v8 Engine which is a javascript Engine that converts javaScript Code to Machine Code.&lt;/li&gt;
&lt;li&gt;It allow Us to Execute &lt;code&gt;JAVASCRIPT&lt;/code&gt; outside the &lt;code&gt;BROWSER&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;NODE JS&lt;/code&gt; was written using:
&lt;code&gt;JavaScript&lt;/code&gt;,&lt;code&gt;CoffeeScript&lt;/code&gt;,&lt;code&gt;C++(wiki)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Life Before NODE JS:
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;JavaScript&lt;/code&gt; runs only inside the &lt;code&gt;Browser&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;JavaScript&lt;/code&gt; was used for &lt;code&gt;FrontEnd developMent&lt;/code&gt; only (Animation and Data Validtion).&lt;/li&gt;
&lt;li&gt;We can't run &lt;code&gt;JavaScript&lt;/code&gt; outside the &lt;code&gt;Browser&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Life after NODE JS:
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;We can excute JavaScript outside the browser.&lt;/li&gt;
&lt;li&gt;JavaScript can be used for &lt;code&gt;Backend Development&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;More job Offer for &lt;code&gt;JavaScript&lt;/code&gt; Developers.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Why NODE JS?
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Super Fast&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Highly Scalable&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Used by Top Companies&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Real Life examples -
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;STATS&lt;/strong&gt;:- Paypal Switched from &lt;code&gt;JAVA&lt;/code&gt; to &lt;code&gt;NODE&lt;/code&gt; and here are the results:&lt;/p&gt;

&lt;p&gt;🛠️&lt;strong&gt;DEVELOPMENT&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built almost twice as fast with fewer people.&lt;/li&gt;
&lt;li&gt;Written in 33% fewer lines of code.&lt;/li&gt;
&lt;li&gt;Constructed with 40% fewer files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚙️&lt;strong&gt;PERFORMANCE&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Double the requests per second vs the Java application:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️This is even more interesting because the intial performance results were using a SINGLE core for the node.js application comared to FIVE cores in java🤯.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;35% decrease in the average response time for the same page:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💥This resulted in the pages being served 200ms faster (Something Users will definitely notice).&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
