<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Jatin's Blog]]></title><description><![CDATA[Jatin's Blog]]></description><link>https://hashnode.j471n.in</link><generator>RSS for Node</generator><lastBuildDate>Sun, 07 Jun 2026 05:53:44 GMT</lastBuildDate><atom:link href="https://hashnode.j471n.in/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Typescript: Interface]]></title><description><![CDATA[In this article, you'll learn about what interface are and how to use them, along with the difference between type and interface. This article gives you a basic understanding of the interface.

This is going to be a full series of typescript where yo...]]></description><link>https://hashnode.j471n.in/typescript-interface</link><guid isPermaLink="true">https://hashnode.j471n.in/typescript-interface</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[webdev]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Wed, 10 May 2023 17:35:27 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1675313987261/afebe9c6-c73e-419d-b5d1-2014e189f475.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, you'll learn about what interface are and how to use them, along with the difference between <code>type</code> and <code>interface</code>. This article gives you a basic understanding of the interface.</p>
<blockquote>
<p>This is going to be a full series of typescript where you will learn from basic topics like string, boolean to more complex like Type Aliases, enums, Interface, generics, and etc.</p>
</blockquote>
<h2 id="heading-interface">Interface</h2>
<p>An <em>interface declaration</em> is another way to name an object type. You can create it by using the <code>interface</code> keyword:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">interface</span> User {
    name: <span class="hljs-built_in">string</span>,
    age: <span class="hljs-built_in">number</span>,
}

<span class="hljs-comment">// ✅ CORRECT</span>
<span class="hljs-keyword">let</span> newUser : User = {name: <span class="hljs-string">"John"</span>, age: <span class="hljs-number">28</span>};
<span class="hljs-comment">// ❌ ERROR: property 'age' is missing</span>
<span class="hljs-keyword">let</span> newUser : User = {name: <span class="hljs-string">"John"</span>};
<span class="hljs-comment">// ❌ ERROR: missing the following properties from type 'User': name, age </span>
<span class="hljs-keyword">let</span> newUser : User = {};
</code></pre>
<p>You can also use <code>readonly</code> and optional approach in <code>interface</code>:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">interface</span> User {
    <span class="hljs-keyword">readonly</span> id: <span class="hljs-built_in">number</span>     <span class="hljs-comment">// readonly variable</span>
    name: <span class="hljs-built_in">string</span>,
    age: <span class="hljs-built_in">number</span>,
    specialKey? : <span class="hljs-built_in">string</span>,     <span class="hljs-comment">// optional </span>
}
</code></pre>
<p>You can also pass functions to the <code>interface</code>, there are two ways to do that:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// Method-1</span>
<span class="hljs-keyword">interface</span> User {
    getDiscount(coupon: <span class="hljs-built_in">string</span>): <span class="hljs-built_in">number</span>        
}

<span class="hljs-comment">// For Both you need to call this like this:</span>
<span class="hljs-keyword">const</span> newUser: User = {
    getDiscount: <span class="hljs-function">(<span class="hljs-params">coupon: <span class="hljs-string">"KIJ298DD9J"</span></span>) =&gt;</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-number">10</span>;
    }
}

<span class="hljs-comment">// Method-2</span>
<span class="hljs-keyword">interface</span> User {
    getDiscount: <span class="hljs-function">(<span class="hljs-params">coupon: <span class="hljs-built_in">string</span></span>) =&gt;</span> <span class="hljs-built_in">number</span>
}

<span class="hljs-comment">// 👉 You see I have changed the 'coupon' to 'couponName'</span>
<span class="hljs-comment">// You don't need to match the name of the parameter here</span>
<span class="hljs-comment">// It will take care of it</span>
<span class="hljs-keyword">const</span> newUser: User = {
    getDiscount: <span class="hljs-function">(<span class="hljs-params">couponName: <span class="hljs-string">"KIJ298DD9J"</span></span>) =&gt;</span> {
        <span class="hljs-keyword">return</span> <span class="hljs-number">10</span>;
    }
}
</code></pre>
<p>In <strong>Method 1</strong> you can simply use the <code>()</code> to say it functions like: <code>getDiscount(): number</code> and string are the return types, and it takes no arguments.</p>
<p>In <strong>Method 2</strong> we use an arrow function like <code>getDiscount: () =&gt; number</code>.</p>
<h2 id="heading-interface-vs-type">Interface vs Type</h2>
<p>Type aliases and interfaces are very similar, and in many cases, you can choose between them freely. Almost all features of an <code>interface</code> are available in <code>type</code> The key distinction is that a type cannot be reopened to add new properties vs. an interface that is always extendable.</p>
<p>Let’s Differentiate them with a few examples:</p>
<h3 id="heading-adding-new-fields">Adding new fields</h3>
<p>In <code>interface</code> you can add new fields to the existing interface, but you cannot add new fields to an existing type. It will throw an error.</p>
<p><strong>Interface</strong></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> User {
    id: <span class="hljs-built_in">string</span>;    
    email: <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">interface</span> User {
    name: <span class="hljs-built_in">string</span>;
}

<span class="hljs-comment">// Now you can add all the three values to the User interface</span>
<span class="hljs-keyword">const</span> user: User = {
    id: <span class="hljs-string">"2323232"</span>,
    email: <span class="hljs-string">"foo@email.com"</span>,
    name: <span class="hljs-string">"Foo"</span>;
}
</code></pre>
<p><strong>Type</strong></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">type</span> User = {
    id: <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">type</span> User = {
    email: <span class="hljs-built_in">string</span>;
}

<span class="hljs-comment">// ❌ ERROR: Duplicate identifier "User"</span>
</code></pre>
<p>In <code>interface</code> you can add new fields and can change them however you want but in <code>type</code> you can't do that. Once a <code>type</code> is created it can't be changed.</p>
<h3 id="heading-extends">Extends</h3>
<p>To extend the already defined <code>interface</code> or <code>type</code> both have a different approach. <code>interface</code> uses <code>extends</code> keyword, while <code>type</code> uses intersection.</p>
<p><strong>interface</strong></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> Car {
    model: <span class="hljs-built_in">string</span>;
    color: <span class="hljs-built_in">string</span>;
}

<span class="hljs-comment">// 👇 You can extend an interface using 'extends' keywords</span>
<span class="hljs-keyword">interface</span> Tesla <span class="hljs-keyword">extends</span> Car {
  autoPilotModelName: <span class="hljs-built_in">string</span>;
};

<span class="hljs-comment">// ✅ Use Case</span>
<span class="hljs-keyword">const</span> newCar: Tesla = {
    model: <span class="hljs-string">"S"</span>,
    color: <span class="hljs-string">"red"</span>,
    autoPilotModelName: <span class="hljs-string">"xyz"</span>
}
</code></pre>
<p><strong>type</strong></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">type</span> Car = {
    model: <span class="hljs-built_in">string</span>;
    color: <span class="hljs-built_in">string</span>;
}
<span class="hljs-comment">// 👇 In type you need to use Intersection</span>
<span class="hljs-keyword">type</span> Tesla = Car &amp; {
  autoPilotModelName: <span class="hljs-built_in">string</span>;
};

<span class="hljs-keyword">const</span> newCar: Tesla = {
    model: <span class="hljs-string">"S"</span>,
    color: <span class="hljs-string">"red"</span>,
    autoPilotModelName: <span class="hljs-string">"xyz"</span>
}
</code></pre>
<h3 id="heading-union">Union</h3>
<p>In <code>interface</code> you cannot create a union type, but you can do that if you are using <code>type</code>. Let's take an example:</p>
<p><strong>interface</strong></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">interface</span> User  {
    email: <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">interface</span> Admin  {
    email: <span class="hljs-built_in">string</span>;
    adminKey: <span class="hljs-built_in">string</span>;
}

<span class="hljs-comment">// ❌ ERROR: '{' expected.</span>
<span class="hljs-keyword">interface</span> Person = User | Admin;

// ✅ CORRECT: you can create union type like this
type Person = User | Admin;

// ✅ CORRECT: However you can use union type inside the <span class="hljs-keyword">interface</span>
<span class="hljs-keyword">interface</span> Person {
    person: User | Admin;
}
</code></pre>
<p><strong>type</strong></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">type</span> User = {
    email: <span class="hljs-built_in">string</span>;
}

<span class="hljs-keyword">type</span> Admin = {
    email: <span class="hljs-built_in">string</span>;
    adminKey: <span class="hljs-built_in">string</span>;
}

<span class="hljs-comment">// ✅ You can do that.</span>
<span class="hljs-keyword">type</span> Person = User | Admin;
</code></pre>
<p>In the above example, you might have noticed that when I tried to assign a union type to the interface (<code>interface Person = User | Admin</code>) it throws an error. It's because you cannot assign anything to <code>interface</code>. Its deceleration syntax is similar to <code>class</code>. But both have different working.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">class</span> MyClass {}

<span class="hljs-keyword">interface</span> Hello {}
</code></pre>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>In this article, I have explained what <code>interface</code> is and how to use it, along with the difference between <code>type</code> and <code>interface</code>. This article gives you a basic understanding of the interface.</p>
<p>This is a series of Typescript lessons that will help you learn Typescript from scratch. If you enjoyed this article, then don't forget to give ❤️ and bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see you in the next one.</p>
<p><strong>Connect with me</strong></p>
<ul>
<li><p><a target="_blank" href="https://twitter.com/j471n_">Twitter</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/j471n">GitHub</a></p>
</li>
<li><p><a target="_blank" href="https://www.linkedin.com/in/j471n/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://instagram.com/j471n_">Instagram</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.in">Website</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.substack.com/">Newsletter</a></p>
</li>
<li><p><a target="_blank" href="https://www.buymeacoffee.com/j471n">Buy me a coffee</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Typescript: Enums]]></title><description><![CDATA[In this article, you'll learn about what enums are and how you can use them in your projects. Enums, short for Enumerated Types.

This is going to be a full series of typescript where you will learn from basic topics like string, boolean to more comp...]]></description><link>https://hashnode.j471n.in/typescript-enums</link><guid isPermaLink="true">https://hashnode.j471n.in/typescript-enums</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[webdev]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Sun, 12 Mar 2023 18:48:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1675313147063/254abb3f-47bc-4193-a1b3-829fdbda5217.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, you'll learn about what enums are and how you can use them in your projects. Enums, short for Enumerated Types.</p>
<blockquote>
<p>This is going to be a full series of typescript where you will learn from basic topics like string, boolean to more complex like Type Aliases, enums, Interface, generics, and etc.</p>
</blockquote>
<h2 id="heading-enums">Enums</h2>
<p>Enums are one of the few features TypeScript has which is not a type-level extension of JavaScript.</p>
<p>Enums allow a developer to define a set of named constants. Using enums can make it easier to document intent, or create a set of distinct cases. TypeScript provides both numeric and string-based enums.</p>
<h3 id="heading-numeric-enums">Numeric enums</h3>
<p>We will first take a look at Numeric enums and how we can create them. An enum can be defined using the <code>enum</code> keyword.</p>
<pre><code class="lang-ts"><span class="hljs-built_in">enum</span> Direction  {
    Up, 
    Down, 
    Left, 
    Right,
}
</code></pre>
<p>Above, we have a numeric enum where <code>Up</code> is initialized with <code>0</code>. All of the following members are auto-incremented from that point on. In other words, <code>Direction.Up</code> has the value <code>0</code>, <code>Down</code> has <code>1</code>, <code>Left</code> has <code>2</code>, and <code>Right</code> has <code>3</code>.</p>
<p>In the Numeric enums, the values are in the incremented order as explained above. You can manipulate these values as you want. Let’s take a few examples of that:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// Up = 1, Down = 2, Left = 3, Right = 4</span>
<span class="hljs-built_in">enum</span> Direction  {
    Up = <span class="hljs-number">1</span>, 
    Down, 
    Left, 
    Right,
}

<span class="hljs-comment">// Up = 1, Down = 5, Left = 6, Right = 7</span>
<span class="hljs-built_in">enum</span> Direction  {
    Up, 
    Down = <span class="hljs-number">5</span>, 
    Left, 
    Right,
}

<span class="hljs-comment">// Up = 10, Down = 11, Left = 14, Right = 15</span>
<span class="hljs-built_in">enum</span> Direction  {
    Up = <span class="hljs-number">10</span>, 
    Down, 
    Left = <span class="hljs-number">14</span>, 
    Right,
}
</code></pre>
<p>In the above code example, I have updated the values and shown you what will be the value of the others members.</p>
<h3 id="heading-string-enums">String enums</h3>
<p>String enums are a similar concept. In a string enum, each member has to be constant-initialized with a string literal, or with another string enum member.</p>
<pre><code class="lang-ts"><span class="hljs-built_in">enum</span> Direction {
  Up = <span class="hljs-string">"UP"</span>,
  Down = <span class="hljs-string">"DOWN"</span>,
  Left = <span class="hljs-string">"LEFT"</span>,
  Right = <span class="hljs-string">"RIGHT"</span>,
}
</code></pre>
<p>To access any members you can do the following:</p>
<pre><code class="lang-ts"><span class="hljs-built_in">console</span>.log(Direction.Up) <span class="hljs-comment">// output: UP</span>
</code></pre>
<h3 id="heading-heterogeneous-enums">Heterogeneous enums</h3>
<p><code>enums</code> can be mixed with string and numeric members, but it’s not clear why you would ever want to do so. it’s advised that you don’t do this.</p>
<pre><code class="lang-ts"><span class="hljs-built_in">enum</span> ExtraFries {
  No = <span class="hljs-number">0</span>,
  Yes = <span class="hljs-string">"YES"</span>,
}
</code></pre>
<p>If you want to learn more about <strong>Enums</strong>, consider reading the <a target="_blank" href="https://www.typescriptlang.org/docs/handbook/enums.html">documentation</a>.</p>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>In this article, I have explained what enums are and how you can use them in your projects. Enums, short for Enumerated Types.</p>
<p>This is a series of Typescript that will help you to learn Typescript from the scratch. If you enjoyed this article, then don't forget to give ❤️ and Bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<ul>
<li><p><a target="_blank" href="https://twitter.com/j471n_">Twitter</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/j471n">GitHub</a></p>
</li>
<li><p><a target="_blank" href="https://www.linkedin.com/in/j471n/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://instagram.com/j471n_">Instagram</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.in">Website</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.substack.com/">Newsletter</a></p>
</li>
<li><p><a target="_blank" href="https://www.buymeacoffee.com/j471n">Buy me a coffee</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Chrome Extensions of the Month - February 2023]]></title><description><![CDATA[In this article, I will suggest to you some of the best extensions you need to install for better productivity that can come in very handy. So without further due, let's get into it.
OSlash
OSlash is a free, top-rated Text Expander and Custom Keyboar...]]></description><link>https://hashnode.j471n.in/chrome-extensions-of-the-month-february-2023</link><guid isPermaLink="true">https://hashnode.j471n.in/chrome-extensions-of-the-month-february-2023</guid><category><![CDATA[Productivity]]></category><category><![CDATA[Chrome Extensions of the Month]]></category><category><![CDATA[chrome extension]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Tue, 28 Feb 2023 08:30:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1677394741716/b7f1c6be-2c71-4629-b3ba-63c43b667d94.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I will suggest to you some of the best extensions you need to install for better productivity that can come in very handy. So without further due, let's get into it.</p>
<h2 id="heading-oslash">OSlash</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/oslash-text-expander-and/gpljeioabgadbidbkcbhjjglpinfhmal">OSlash</a> is a free, top-rated Text Expander and Custom Keyboard Shortcut for you and your team. Using OSlash Text Expander, insert text templates everywhere you work in apps such as Gmail, LinkedIn, Intercom, and Google Docs.</p>
<p><img src="https://lh3.googleusercontent.com/ZaX5XnMfQqOhUKCv70fasHxHhyWb45kbyWugVSkQS-fzHul8AhFZa3v_hqt6lTmDzSMV-zhHI510uNGm58pTkntjUg=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<p><img src="https://lh3.googleusercontent.com/gI4cs3csNFDpwF4Xw-q6-41QjCZgUFkbigVygaKRl8Ikt5uKE03HS3nHwtJl02Dr2HRdhIOUiG2gGaPuZ8kY5jnq=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-auto-group-tabs">Auto Group Tabs</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/auto-group-tabs/ekjmngjikhikadcbbidpfdaocifddaip">Auto Group Tabs</a> Keeps your tab bar tidy with auto grouping without the need to group them manually. Group tabs automatically based on URL.</p>
<p><img src="https://lh3.googleusercontent.com/A2VGNAqOiXNevP_7140NiW4IsOzTM3axTVQ1E6WTwa13w9MI7TBGfW6jAR8fKcmnwY8HxKBrJJ2Qa2roFAWnbd7ZRw=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-validity">Validity</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/validity/bbicmjjbohdfglopkidebfccilipgeif">Validity</a> can be used to quickly validate your HTML documents from the toolbar. Just click the icon in the toolbar to validate the current document without leaving the page. The number of validation errors can be seen in the tool tip and the detail can be seen in the console tab of Chrome's developer tools.</p>
<p><img src="https://lh3.googleusercontent.com/CMxzRA-jU3mckPzZpF5DWkhhzLjHR3KEleh_5fBKIckD7QMGJ9z6qNME65Bl1h2qQrtFzfal1O9cEX6qHWiTn3wg4w=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-find">Find+</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/find%2B-regex-find-in-page/fddffkdncgkkdjobemgbpojjeffmmofb">{find+}</a> is a powerful Find-in-Page extension for Google Chrome allowing you to search a web page or document by regular expression. It has been designed to look and behave much like the native CTRL+F tool, but extended with various useful features.</p>
<p><img src="https://lh3.googleusercontent.com/IjiJrnzn44W01uIHsNmUP1s8FxqueTAAAxR-PlgDGgbDwuE_qskZ9RI98vHo5x1Sry70mziQ90B4qCTM74c-5_z2fw=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-gimli-tailwind">Gimli Tailwind</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/gimli-tailwind/fojckembkmaoehhmkiomebhkcengcljl">Gimli Tailwind</a> lets developers debug and work with Tailwind CSS more intuitively. This is a DevTools extension enabling smart tools for Tailwind CSS.</p>
<p><img src="https://lh3.googleusercontent.com/ADqozONu5ski6YRXrRQCrD-bxMg8dESx_uBn4c-APAe9DNs_xjl9PQlgDT87CGZbntGuuPVxuLsh_z-MEO88MTZGSA=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-eesel">Eesel</h2>
<p>All your Google Docs, Notion pages and other work documents, right in your new tab. Your team creates many work docs in many different apps. A project brief in Google Docs, a timeline in Notion, a mockup in Figma. It can be an exhausting game of trial and error to find the links you need, and that's where <a target="_blank" href="https://chrome.google.com/webstore/detail/eesel-the-new-tab-for-wor/jffaiidojfhflballoapgofphkadiono">eesel</a> comes in.</p>
<p><img src="https://lh3.googleusercontent.com/iMe0G5-irvmBhAQ0YK3Pbs5YkqU4CkGmLzL27rvN0TROoMjyuqkAcNMiZHgffvtoK_1D-z25-jOqXVkpSp9MG_oJcQ=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-buffer">Buffer</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/buffer/noojglkidnpfjbincgijbaiedldjfbhh?hl=en">Buffer</a> is the best way to share great content to Social Networks from anywhere on the web. The Buffer Chrome extension allows you to schedule posts to Buffer (<a target="_blank" href="https://buffer.com">https://buffer.com</a>). By using this tool, you will be able to create and schedule your social media content faster from anywhere on the web. As we add updates to <a target="_blank" href="http://Buffer.com">Buffer.com</a>, you’ll automatically get the new features here, too!</p>
<p><img src="https://lh3.googleusercontent.com/uIGzRAPt9IhTfNXzOPtGp74N9iCaJv6lrXH1lo-t2tMTXt9EZzQ2u2epTsWKZseMStTbv5TQRLXCKTCwNhfXHkfc6n8=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-duckduckgo-privacy-essentials">DuckDuckGo Privacy Essentials</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/duckduckgo-privacy-essent/bkdgflcldnnnapblkhphbgpggdiikppg?hl=en">DuckDuckGo Privacy Essentials</a> is used for protecting your privacy online. Locking the front door won’t stop the most determined folks from getting inside, especially if you’ve left the back door and windows unlocked and an extra key under the doormat. That’s why we offer multiple types of privacy protection, all with the single purpose of better protecting your privacy in Chrome.</p>
<p><img src="https://lh3.googleusercontent.com/4ejTSepN79f8uaOChkHup6-J-7Vb3J7p2MFGXe1gjUifym-uc36MdEBjCFmiyZEUTnzrXXV7zacSHPyAEM_OPYoLug=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<p><img src="https://lh3.googleusercontent.com/iYtWe5HNmWszwt-SCjvgKodWwnF4WBuvMkn2tDH5k-chANe6MJRB98Wh7RY73hDGQyQVaI2htZkx104aSF2U_IpD=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-save-image-as-type">Save image as Type</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/save-image-as-type/gabfmnliflodkdafenbcpjdlppllnemd?hl=en">Save image</a> as PNG, JPG or WebP by context menu on image. Add context menu for images to save image as PNG, JPG or WebP format.</p>
<p><img src="https://lh3.googleusercontent.com/GxY1qe6ENSpwtiw9-Bp0mtLQ38uQQQWgXntYWlIjT2aW3cLBYS2OF2_Xdggi92HmSoAkD8eSFhKxV-HdM7qjFhifZg=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-awesome-screenshot-and-screen-recorder">Awesome Screenshot and Screen Recorder</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/awesome-screenshot-and-sc/nlipoenfbbikpbjkfpfillcgkoblgpmj">Awesome Screenshot and Screen Recorder</a> is the best screen recorder and screen capture &amp; screenshot tool to record screens.</p>
<p><strong>Features</strong></p>
<ul>
<li><p>Provide stable service for more than 10 years</p>
</li>
<li><p>Loved by more than 3 million users across different platforms 👍</p>
</li>
<li><p>️Local Screen Recorder &amp; Cloud Screen recorder 2 in 1</p>
</li>
<li><p>Screenshot / Screen capture &amp; Screen recorder 2 in 1</p>
</li>
<li><p>Instant sharing of your screenshots and screen recordings</p>
</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/5_RfvhY7bsBguxe9N4pHb55YllfHCIgIPBSPLhlScHF-Q9Jy5yjsy30k6FxOPjrDLeJuXChIWo8R3L2EtrP60Eso=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<p><img src="https://lh3.googleusercontent.com/GqtBc7wJxq7yBsJ-kO6tTSRct6hypcgclj_m7CkepgZUMgAZh4LPk_XsSyxauEIJGYcRE7tIOTmun_wNBU_yaEtNig=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<p><img src="https://lh3.googleusercontent.com/q6WVCMxriY4MRj6RYUd72TOfwc6T8dJ-1eHMYEPBNnxeAUyB--ApWQbEX3e2UF7JhfNngn4494IigX9Aeu_rIueA-uQ=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h3 id="heading-wrapping-up"><strong>Wrapping up</strong></h3>
<p>These were some extensions for this month (February 2023). You might have heard some before, but if you like anyone then don't forget to press ❤️. I have personally used all the above extensions and from my experience, every extension is worth installing.</p>
]]></content:encoded></item><item><title><![CDATA[Operating System and it's concepts]]></title><description><![CDATA[In this article, I'll be explaining what is an operating system, its functions, types and services. What are kernel, shell and system calls? and what is CPU scheduling? This will be a short or brief introduction about each of the mentioned topics.
Wh...]]></description><link>https://hashnode.j471n.in/operating-system-and-its-concepts</link><guid isPermaLink="true">https://hashnode.j471n.in/operating-system-and-its-concepts</guid><category><![CDATA[operating system]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[CocodeBlogs]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Sat, 11 Feb 2023 16:56:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1676133129490/fd898787-5c89-4a06-ae00-95e0d7695149.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I'll be explaining what is an operating system, its functions, types and services. What are kernel, shell and system calls? and what is CPU scheduling? This will be a short or brief introduction about each of the mentioned topics.</p>
<h2 id="heading-what-is-an-operating-system">What is an operating system?</h2>
<p>An operating system acts as an intermediary between the user of a computer and computer hardware. An operating system is a software that manages computer hardware. The hardware must provide appropriate mechanisms to ensure the correct operation of the computer system and to prevent user programs from interfering with the proper operation of the system.</p>
<h2 id="heading-functions-of-an-operating-system">Functions of an Operating System</h2>
<p>The operating system has the following functions:</p>
<h3 id="heading-booting">Booting</h3>
<ul>
<li><p>Use diagnostic routines to test the system for equipment failure.</p>
</li>
<li><p>Copies BIOS (Basic Input/Output System) programs from ROM chips to main memory.</p>
</li>
<li><p>Loads operating system into computer's main memory.</p>
</li>
</ul>
<h3 id="heading-managing-computer-resources">Managing Computer Resources</h3>
<ul>
<li><p>Keeps track of locations in main memory where programs and data are stored (memory management).</p>
</li>
<li><p>Move data and programs back and forth between main memory and secondary storage (swapping) via partitioning, using foreground, using a and background areas, and using buffers and queues.</p>
</li>
</ul>
<h3 id="heading-managing-files">Managing files</h3>
<ul>
<li><p>Copies files/programs from one disk to another.</p>
</li>
<li><p>Backup files/programs.</p>
</li>
<li><p>Erases (deletes) files/programs.</p>
</li>
<li><p>Renames files.</p>
</li>
</ul>
<h2 id="heading-services-provided-by-the-operating-system">Services provided by the operating system</h2>
<p>There is various type of services that the operating system provides. These services are:</p>
<h3 id="heading-program-execution">Program Execution</h3>
<ul>
<li><p>The purpose of the computer system is to allow users to execute programs efficiently.</p>
</li>
<li><p>The operating system provides an environment where the user can conveniently run these programs.</p>
</li>
<li><p>To run a program, the program is required to be loaded into the RAM first and then assigned CPU time for its execution.</p>
</li>
</ul>
<h3 id="heading-io-operations">I/O Operations</h3>
<ul>
<li><p>Each program requires an input and after processing the input submitted by the user it produces an output.</p>
</li>
<li><p>This involves the user of I/O devices.</p>
</li>
<li><p>The I/O service cannot be provided by user-level programs and it must be provided by the operating system.</p>
</li>
</ul>
<h3 id="heading-file-system-manipulation">File System Manipulation</h3>
<ul>
<li><p>While working on the computer, generally a user is required to manipulate various types of files like opening a file, saving a file and deleting a file from the storage disk.</p>
</li>
<li><p>This is an important task that is also performed by the operating system.</p>
</li>
</ul>
<h3 id="heading-communication">Communication</h3>
<ul>
<li><p>The operating system performs communication among various types of processes in the form of shared memory.</p>
</li>
<li><p>Communications may be implemented via shared memory, in which two or more processes read and write to a shared section of memory.</p>
</li>
</ul>
<h3 id="heading-error-detection">Error Detection</h3>
<ul>
<li><p>The main function of the operating system is to detect and the errors like bad sector on the hard disk, memory overflow and errors related to I/O devices and other components.</p>
</li>
<li><p>After detecting the errors, the operating system takes an appropriate action fo consistent computing.</p>
</li>
</ul>
<h3 id="heading-resource-allocation">Resource Allocation</h3>
<ul>
<li><p>In the multitasking environment, when multiple processes are running at the same time, it is the responsibility of the operating system to allocate the required resources to each process for its better utilization.</p>
</li>
<li><p>These resources include CPU, main memory, tape drive or secondary storage, etc.</p>
</li>
</ul>
<h3 id="heading-protection-and-security">Protection and Security</h3>
<ul>
<li><p>Protection involved ensuring that all access to system resources is controlled.</p>
</li>
<li><p>Such security starts with requiring each user to authenticate him or her to the system, usually using a password, to gain access to system resources.</p>
</li>
</ul>
<h2 id="heading-type-of-operating-system">Type of Operating System</h2>
<p>There are various types of operating systems:</p>
<h3 id="heading-batch-system">Batch System</h3>
<p>This type of operating system was used in the earlier age, to speed up processing, jobs with similar needs were batched together and were run through the computer as a group. The definitive feature of a batch system is the lack of interaction between the user and the job while the job is executing. In this execution environment, the CPU is often idle.</p>
<h3 id="heading-multi-programming-system">Multi-programming System</h3>
<p>In this type of OS, more than one program will reside in the main memory. The OS picks and begins to execute one of the jobs in the memory. Eventually, the job may have to wait for some task, the operating system simply switches to another job and executes it. When the first job finishes, the waiting job gets the CPU back. As long as there is always some job to execute, the CPU will never be idle.</p>
<h3 id="heading-time-sharing-system">Time-sharing System</h3>
<p>A time-shared OS, allows many users to share the computer simultaneously. A time-shared operating system uses CPU scheduling and multi-programming to provide each user with a small portion of a time-shared computer.</p>
<h3 id="heading-real-time-operating-system">Real-time Operating System</h3>
<p>The real-time operating system is a special-purpose operating system, used when there are rigid time requirements for the operation of a processor or the flow of data.</p>
<h2 id="heading-difference-between-shell-and-kernel">Difference between shell and kernel</h2>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Shell</td><td>Kernel</td></tr>
</thead>
<tbody>
<tr>
<td>When a user logs in, the login program checks the username and password and then starts another program called a shell.</td><td>The kernel is the hub of the operating systems, it allocates time and memory to programs and handles file storage and communications in response to system calls.</td></tr>
<tr>
<td>Shell gives an interface between the user and the kernel.</td><td>The kernel gives the hardware interaction with the user.</td></tr>
<tr>
<td>The shell is the GUI or interface to the kernel</td><td>The kernel is part of the operating system that interacts with the hardware.</td></tr>
</tbody>
</table>
</div><h2 id="heading-what-are-system-calls">What are system calls?</h2>
<p>System calls provide an interface to the services made available by an operating system. These calls are generally available as routines written in C and C++, although certain low-level tasks (for example, tasks where hardware must be accessed directly), may need to write using assembly language.</p>
<p>Following are some system calls used in process management:</p>
<ul>
<li><p><strong>fork()</strong>: To create a new process.</p>
</li>
<li><p><strong>exec()</strong>: To execute a new program in a process.</p>
</li>
<li><p><strong>wait()</strong>: To wait until a created process completes its execution.</p>
</li>
<li><p><strong>exit()</strong>: To exit from a process execution.</p>
</li>
<li><p><strong>getpid():</strong> To get a process identifier of the current process.</p>
</li>
<li><p><strong>getppid()</strong>: To get parent process identifier.</p>
</li>
<li><p><strong>brk()</strong>: To increase/decrease the data segment size of a process.</p>
</li>
</ul>
<h2 id="heading-what-is-cpu-scheduling">What is CPU scheduling?</h2>
<p>CPU scheduling is the management of CPU resources. The scheduling mechanism is part of the process manager that handles the removal of the running process from the CPU and the selection of another process based on a particular strategy. CPU scheduling is the basis of muli-programmed operating systems. The scheduler is responsible for multiplexing processes on the CPU. CPU scheduling is used to increase CPU utilization.</p>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>In this article, I've explained what is an operating system, its functions, types and services. What are kernel, shell and system calls? and what is CPU scheduling? Now you have a little bit of an understanding of each of the topics. If you want more explanation on these or another topic just let me know in the comments section. And don't forget to ❤️ the article. I'll see you in the next one.</p>
<p><strong>Connect with me</strong></p>
<ul>
<li><p><a target="_blank" href="https://twitter.com/j471n_">Twitter</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/j471n">GitHub</a></p>
</li>
<li><p><a target="_blank" href="https://www.linkedin.com/in/j471n/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://instagram.com/j471n_">Instagram</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.in">Website</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.substack.com/">Newsletter</a></p>
</li>
<li><p><a target="_blank" href="https://www.buymeacoffee.com/j471n">Buy me a coffee</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Typescript: Array & Tuples]]></title><description><![CDATA[In this article, We are going learn about how you can use type in Array and there is a special thing that is Read only Array. In which you can't manipulate the values. In addition, I'll talk about Tuples as well. How you can use it?

This is going to...]]></description><link>https://hashnode.j471n.in/typescript-array-tuples</link><guid isPermaLink="true">https://hashnode.j471n.in/typescript-array-tuples</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Wed, 08 Feb 2023 12:27:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1672384386606/df07267e-80e7-430b-9170-33f7639be3c1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, We are going learn about how you can use type in Array and there is a special thing that is Read only Array. In which you can't manipulate the values. In addition, I'll talk about Tuples as well. How you can use it?</p>
<blockquote>
<p>This is going to be a full series of typescript where you will learn from basic topics like string, boolean to more complex like Type Aliases, enums, Interface, generics, and etc.</p>
</blockquote>
<h2 id="heading-arrays">Arrays</h2>
<p>To create an Array of a certain type there is a special syntax for that:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> variableName: arrayType[] = []

<span class="hljs-comment">// For example: </span>
<span class="hljs-keyword">let</span> num: <span class="hljs-built_in">number</span>[] = [<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>]
<span class="hljs-keyword">let</span> name: <span class="hljs-built_in">string</span>[] = [<span class="hljs-string">"sam"</span>, <span class="hljs-string">"john"</span>]
</code></pre>
<p>As shown in the above example that you can define the array's type by using the type followed by square brackets (<code>number[]</code>)</p>
<p>This is simple right? Let's look at some other concepts. Let's look at the Dos and Don'ts of an Array:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// ❌ DON'T </span>
<span class="hljs-comment">// If you define an array like this then the type will be 'never'</span>
<span class="hljs-comment">// which means you can't push anything</span>
<span class="hljs-keyword">let</span> num:[] = []
num.push(<span class="hljs-number">1</span>) <span class="hljs-comment">// ERROR</span>


<span class="hljs-keyword">let</span> num:<span class="hljs-built_in">number</span>[] = []
num.push(<span class="hljs-number">1</span>)
num.push(<span class="hljs-string">"232"</span>)  <span class="hljs-comment">// ❌ ERROR : rgument of type 'string' is not assignable</span>


<span class="hljs-keyword">let</span> names:<span class="hljs-built_in">string</span>[] = []
names.push(<span class="hljs-string">"john"</span>)
names.push(<span class="hljs-number">1</span>)     <span class="hljs-comment">// ❌ ERROR : rgument of type 'number' is not assignable</span>

<span class="hljs-comment">/* -----------Let's Add Objects into Array-------- */</span>
<span class="hljs-keyword">type</span> User ={
    name: <span class="hljs-built_in">string</span>,
    email: <span class="hljs-built_in">string</span>,
}

<span class="hljs-comment">// ✅ That's how you can define an array of objects</span>
<span class="hljs-keyword">const</span> allUsers: User[] = [];

<span class="hljs-comment">// ✅ CORRECT</span>
allUsers.push({name: <span class="hljs-string">"sam"</span>, email:<span class="hljs-string">"sam@hello.com"</span>})
<span class="hljs-comment">// ❌ ERROR: email property missing</span>
allUsers.push({name: <span class="hljs-string">"sam"</span>})
<span class="hljs-comment">// ❌ ERROR: missing name &amp; email</span>
allUsers.push({})
</code></pre>
<p>The above example shows how you can use Array. There is one more way to create an Array:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> newArray: <span class="hljs-built_in">Array</span>&lt;<span class="hljs-built_in">number</span>&gt; = []
<span class="hljs-keyword">let</span> nameArray: <span class="hljs-built_in">Array</span>&lt;<span class="hljs-built_in">string</span>&gt; = []
<span class="hljs-keyword">let</span> allUsers: <span class="hljs-built_in">Array</span>&lt;User&gt; = []
</code></pre>
<p>It means that creating an Array of the defined type in <code>&lt;&gt;</code>.</p>
<h3 id="heading-readonly-array">Readonly Array</h3>
<p>The <code>ReadonlyArray</code> is a special type that describes arrays that shouldn’t be changed.</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> players: ReadonlyArray&lt;<span class="hljs-built_in">string</span>&gt; = [<span class="hljs-string">"ronaldo"</span>, <span class="hljs-string">"messi"</span>]
<span class="hljs-comment">// or</span>
<span class="hljs-keyword">let</span>  players: <span class="hljs-keyword">readonly</span> <span class="hljs-built_in">string</span>[] = [<span class="hljs-string">"ronaldo"</span>, <span class="hljs-string">"messi"</span>];  

<span class="hljs-comment">// ❌ Can't do that</span>
players[<span class="hljs-number">0</span>] = <span class="hljs-string">"jordon"</span>;
players.push(<span class="hljs-string">"shaq"</span>)

<span class="hljs-comment">// ✅ Can do </span>
<span class="hljs-built_in">console</span>.log(players[<span class="hljs-number">0</span>]);
</code></pre>
<p>In the above code, there are two methods from which you can define the readonly Array.</p>
<p>At the End of this section, I want to add one more thing to this. What if we want a nested Array means Array inside an array? You can do that as shown in the following code:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">const</span> cords: <span class="hljs-built_in">number</span>[][] = [
    [<span class="hljs-number">22</span>, <span class="hljs-number">55</span>],
    [<span class="hljs-number">45</span>, <span class="hljs-number">22</span>]
]

<span class="hljs-keyword">const</span> data: <span class="hljs-built_in">number</span>[][][] = [
    [[<span class="hljs-number">22</span>], [<span class="hljs-number">25</span>, <span class="hljs-number">65</span>]],
    [[<span class="hljs-number">99</span>, <span class="hljs-number">34</span>, <span class="hljs-number">56</span>], [<span class="hljs-number">12</span>, <span class="hljs-number">9</span>]],
]
</code></pre>
<p>You can define the nested array as shown in the above code. You can nest as many arrays as you want. And if you want them to be different types then you need to create a <code>type</code> for them.</p>
<h2 id="heading-tuples">Tuples</h2>
<p>Tuple types are a type of array of known length where the different elements may have different types. A value of type <code>[number, string]</code> is guaranteed to have a <code>length</code> of <code>2</code>, with a <code>number</code> at element <code>0</code> and a <code>string</code> at element <code>1</code>. Let's look at the example:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> x: [<span class="hljs-built_in">number</span>, <span class="hljs-built_in">string</span>];

x = [<span class="hljs-number">110</span>, <span class="hljs-string">"Mohan"</span>]; <span class="hljs-comment">// ✅ CORRECT </span>
x[<span class="hljs-number">0</span>] = <span class="hljs-number">120</span>; <span class="hljs-comment">// ✅ CORRECT </span>
x = [<span class="hljs-string">"Mohan"</span>, <span class="hljs-number">110</span>];    <span class="hljs-comment">// ❌ ERROR: Initialize it incorrectly</span>
</code></pre>
<p>Let's take another example of RGB. As you already know RGB takes three values that should be numbered.</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> rgb: [<span class="hljs-built_in">number</span>, <span class="hljs-built_in">number</span>, <span class="hljs-built_in">number</span>];

rgb = [<span class="hljs-number">225</span>, <span class="hljs-number">224</span>, <span class="hljs-number">10</span>];         <span class="hljs-comment">// ✅ CORRECT</span>
rgb = [<span class="hljs-number">225</span>, <span class="hljs-number">224</span>, <span class="hljs-string">"10"</span>];        <span class="hljs-comment">// ❌ ERROR: type 'string' is not assignable to type 'number'</span>
rgb = [<span class="hljs-number">225</span>, <span class="hljs-number">224</span>, <span class="hljs-number">10</span>, <span class="hljs-number">40</span>];    <span class="hljs-comment">// ❌ ERROR : Source has 4 element(s) but target allows only 3</span>
</code></pre>
<p><strong>Issue with Tuples</strong></p>
<p>Tuples sound great right? But they have a major flaw. <strong>TypeScript allows you to call methods like</strong> <code>push()</code>, <code>pop()</code>, <code>shift()</code>, <code>unshift()</code>, and <code>splice()</code> on values of tuple types.</p>
<p>If you don't understand what I am saying then let me show you with code example. I am taking the old example of RGB:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> rgb: [<span class="hljs-built_in">number</span>, <span class="hljs-built_in">number</span>, <span class="hljs-built_in">number</span>];

<span class="hljs-comment">// ✅ This is correct because it has all the values</span>
rgb = [<span class="hljs-number">225</span>, <span class="hljs-number">224</span>, <span class="hljs-number">10</span>];

<span class="hljs-comment">// ❌ ERROR : Source has 4 element(s) but target allows only 3</span>
<span class="hljs-comment">// It is not allowed Right.</span>
rgb = [<span class="hljs-number">225</span>, <span class="hljs-number">224</span>, <span class="hljs-number">10</span>, <span class="hljs-number">40</span>];    

<span class="hljs-comment">// Now let's do this:</span>
rgb.push(<span class="hljs-number">50</span>)
<span class="hljs-built_in">console</span>.log(rgb)  <span class="hljs-comment">// output: [225, 224, 10, 50]</span>
<span class="hljs-comment">// This is the flaw.</span>
</code></pre>
<p>You can apply any Array method to Tuple. That's why it destroys the supposed guarantees of tuple types.</p>
<blockquote>
<p>Don't only rely on Tuples. Use only when necessary.</p>
</blockquote>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>In this article, I explained how you can use type in Array and there is a special thing that is Read only Array. In which you can't manipulate the values. In addition, I'll talk about Tuples as well. How you can use it?</p>
<p>This is a series of Typescript that will help you to learn Typescript from the scratch. If you enjoyed this article, then don't forget to give ❤️ and Bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<ul>
<li><p><a target="_blank" href="https://twitter.com/j471n_">Twitter</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/j471n">GitHub</a></p>
</li>
<li><p><a target="_blank" href="https://www.linkedin.com/in/j471n/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://instagram.com/j471n_">Instagram</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.in">Website</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.substack.com/">Newsletter</a></p>
</li>
<li><p><a target="_blank" href="https://www.buymeacoffee.com/j471n">Buy me a coffee</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[My VS Code setup]]></title><description><![CDATA[In this article, I'll be sharing my VS Code Setup with you. It includes the theme and Icons that use and also Extensions (this is very important).
🎨Theme
I use Andromeda as my primary theme for my vs code

🪟Icons
For Icons, I sometimes switch betwe...]]></description><link>https://hashnode.j471n.in/my-vs-code-setup</link><guid isPermaLink="true">https://hashnode.j471n.in/my-vs-code-setup</guid><category><![CDATA[Productivity]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[webdev]]></category><category><![CDATA[vscode extensions]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Sat, 04 Feb 2023 12:29:37 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1675234454383/f6a8612f-7362-4c32-96a3-26c50c21b38e.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I'll be sharing my VS Code Setup with you. It includes the theme and Icons that use and also Extensions (this is very important).</p>
<h2 id="heading-theme">🎨Theme</h2>
<p>I use <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=EliverLara.andromeda"><strong>Andromeda</strong></a> as my primary theme for my vs code</p>
<p><img src="https://github.com/EliverLara/Andromeda/raw/master/images/andromeda.png" alt="andromeda-screenshot" /></p>
<h2 id="heading-icons">🪟Icons</h2>
<p>For Icons, I sometimes switch between <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=PKief.material-icon-theme"><strong>Material Icon Theme</strong></a> and <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme-icons"><strong>Material Theme Icons</strong></a><strong>.</strong></p>
<h3 id="heading-material-icon-theme">Material Icon Theme</h3>
<p><img src="https://i.imgur.com/xA90m2X.png" alt="Material Icon Theme" /></p>
<h3 id="heading-material-theme-icons">Material Theme Icons</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675233057115/b8d1623c-a092-475e-a66a-91b4a42e5441.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-extensions">⚒️ Extensions</h2>
<p>Now the best part, There are a lot of extensions I mentioned only my favorite or the one that I use mostly every day.</p>
<h3 id="heading-auto-rename-tag">Auto Rename Tag</h3>
<p>Automatically rename paired HTML/XML tag, same as Visual Studio IDE does.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag"><strong>Auto Rename Tag</strong></a></p>
<p><img src="https://github.com/formulahendry/vscode-auto-rename-tag/raw/HEAD/images/usage.gif" alt class="image--center mx-auto" /></p>
<h3 id="heading-bracket-pair-colorization-toggler">Bracket Pair Colorization Toggler</h3>
<p>A VS Code extension that gives you a simple command to quickly toggle the global “Bracket Pair Colorization”</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=dzhavat.bracket-pair-toggler"><strong>Bracket Pair Colorization Toggler</strong></a></p>
<p><img src="https://github.com/dzhavat/bracket-pair-toggler/raw/HEAD/assets/bracket-pair-toggler-demo.gif" alt class="image--center mx-auto" /></p>
<h3 id="heading-cc">C/C++**</h3>
<p>The C/C++ extension adds language support for C/C++ to Visual Studio Code, including editing (IntelliSense) and debugging features.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools"><strong>C/C++</strong></a></p>
<p><img src="https://i.imgur.com/0syu1Ym.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-code-runner">Code Runner</h3>
<p>Run code snippet or code file for multiple languages</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner"><strong>Code Runner</strong></a></p>
<p><img src="https://github.com/formulahendry/vscode-code-runner/raw/HEAD/images/usage.gif" alt="Usage" /></p>
<h3 id="heading-code-spell-checker">Code Spell Checker</h3>
<p>A basic spell checker that works well with code and documents.</p>
<p>The goal of this spell checker is to help catch common spelling errors while keeping the number of false positives low.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker"><strong>Code Spell Checker</strong></a></p>
<p><img src="https://raw.githubusercontent.com/streetsidesoftware/vscode-spell-checker/main/images/example.gif" alt="Example" /></p>
<h3 id="heading-dotenv">DotENV</h3>
<p>VSCode <code>.env</code> syntax highlighting.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=mikestead.dotenv"><strong>DotENV</strong></a></p>
<p><img src="https://github.com/mikestead/vscode-dotenv/raw/master/images/screenshot.png" alt="Example" /></p>
<h3 id="heading-error-lens">Error Lens</h3>
<p>ErrorLens turbo-charges language diagnostic features by making diagnostics stand out more prominently, highlighting the entire line wherever a diagnostic is generated by the language and also prints the message inline.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens"><strong>Error Lens</strong></a></p>
<p><img src="https://raw.githubusercontent.com/usernamehw/vscode-error-lens/master/img/demo.png" alt="Demo image" /></p>
<h3 id="heading-es7-reactreduxreact-native-snippets">ES7+ React/Redux/React-Native snippets</h3>
<p>JavaScript and React/Redux snippets in ES7+ with Babel plugin features for <a target="_blank" href="https://code.visualstudio.com/">VS Code</a></p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets"><strong>ES7+ React/Redux/React-Native snippets</strong></a></p>
<p><img src="https://i.imgur.com/cYpm6cw.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-eslint">ESLint</h3>
<p>The extension uses the ESLint library installed in the opened workspace folder. If the folder doesn't provide one the extension looks for a global install version. If you haven't installed ESLint either locally or globally do so by running <code>npm install eslint</code> in the workspace folder for a local install or <code>npm install -g eslint</code> for a global install.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint"><strong>ESLint</strong></a></p>
<p><img src="https://i.imgur.com/R3o4517.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-git-graph">Git Graph</h3>
<p>View a Git Graph of your repository, and easily perform Git actions from the graph. Configurable to look the way you want!</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph">Git Graph</a></p>
<p><img src="https://github.com/mhutchie/vscode-git-graph/raw/master/resources/demo.gif" alt="Recording of Git Graph" /></p>
<h3 id="heading-gitlens">GitLens</h3>
<p>GitLens <strong>supercharges</strong> Git inside VS Code and unlocks <strong>untapped knowledge</strong> within each repository. It helps you to <strong>visualize code authorship</strong> at a glance via Git blame annotations and CodeLens, <strong>seamlessly navigate and explore</strong> Git repositories, <strong>gain valuable insights</strong> via rich visualizations and powerful comparison commands, and so much more.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens"><strong>GitLens</strong></a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675224552887/688896dd-cfff-41fc-aa2e-53716e5585c6.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-html-boilerplate">HTML Boilerplate</h3>
<p>This extension provides the standard HTML boilerplate code used in all web applications.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=sidthesloth.html5-boilerplate"><strong>HTML Boilerplate</strong></a></p>
<p><img src="https://s19.postimg.cc/3mig98d5v/html_boilerplate_1_0_3.gif" alt="alt text" /></p>
<h3 id="heading-import-cost">Import Cost</h3>
<p>This extension will display inline in the editor the size of the imported package. The extension utilizes webpack in order to detect the imported size.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=wix.vscode-import-cost"><strong>Import Cost</strong></a></p>
<p><img src="https://citw.dev/_next/image?url=%2fposts%2fimport-cost%2f1quov3TFpgG2ur7myCLGtsA.gif&amp;w=1080&amp;q=75" alt="Example Image" /></p>
<h3 id="heading-live-server">Live Server</h3>
<p>It'll enable live changes without saving files.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer"><strong>Live Server</strong></a></p>
<p><img src="https://github.com/ritwickdey/vscode-live-server/raw/HEAD/images/Screenshot/vscode-live-server-animated-demo.gif" alt="Live Server Demo VSCode" /></p>
<h3 id="heading-markdown-all-in-one">Markdown All in One</h3>
<p>All you need for Markdown (keyboard shortcuts, table of contents, auto preview and more).</p>
<p><strong><em>Note</em></strong>: VS Code has basic Markdown support out-of-the-box (e.g, <strong>Markdown preview</strong>), please see the <a target="_blank" href="https://code.visualstudio.com/docs/languages/markdown">official documentation</a> for more information.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one"><strong>Markdown All in One</strong></a></p>
<p><img src="https://github.com/yzhang-gh/vscode-markdown/raw/master/images/gifs/toggle-bold.gif" alt="toggle bold gif" /></p>
<h3 id="heading-markdown-preview-enhanced">Markdown Preview Enhanced</h3>
<p>It shows the enhanced preview of your markdown content.</p>
<p><strong>Download:</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=shd101wyy.markdown-preview-enhanced"><strong>Markdown Preview Enhanced</strong></a></p>
<p><img src="https://user-images.githubusercontent.com/1908863/28495106-30b3b15e-6f09-11e7-8eb6-ca4ca001ab15.png" alt="intro" /></p>
<h3 id="heading-paste-json-as-code">Paste JSON as Code</h3>
<p>Copy JSON, paste as Go, TypeScript, C#, C++ and more.</p>
<p><strong>Download -</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=quicktype.quicktype"><strong>Paste JSON as Code</strong></a></p>
<p><img src="https://raw.githubusercontent.com/quicktype/quicktype-vscode/master/media/demo-interactive.gif" alt="Paste JSON as Code" /></p>
<h3 id="heading-prettier">Prettier</h3>
<p>Code formatter using prettier</p>
<p><strong>Download -</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode"><strong>Prettier</strong></a></p>
<p><img src="https://i.imgur.com/wHlMe9e.png" alt="Prettier" /></p>
<h3 id="heading-python">Python</h3>
<p>IntelliSense (Pylance), Linting, Debugging (multi-threaded, remote), Jupyter Notebooks, code formatting, refactoring, unit tests, and more.</p>
<p><strong>Download -</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=ms-python.python"><strong>Python</strong></a></p>
<p><img src="https://i.imgur.com/cQ1ARrG.png" alt="Python" /></p>
<h3 id="heading-settings-sync">Settings Sync</h3>
<p>Synchronize Settings, Snippets, Themes, File Icons, Launch, Keybindings, Workspaces and Extensions Across Multiple Machines Using GitHub Gist.</p>
<p><strong>Download -</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync"><strong>Settings Sync</strong></a></p>
<p><img src="https://shanalikhan.github.io/img/login-with-github.png" alt="Settings Sync" /></p>
<h3 id="heading-tailwind-css-intellisense">Tailwind CSS IntelliSense</h3>
<p>Intelligent Tailwind CSS tooling for VS Code</p>
<p><strong>Download -</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss"><strong>Tailwind CSS IntelliSense</strong></a></p>
<p><img src="https://raw.githubusercontent.com/bradlc/vscode-tailwindcss/master/packages/vscode-tailwindcss/.github/banner.png" alt="Tailwind CSS IntelliSense" /></p>
<h3 id="heading-todo-highlight">TODO Highlight</h3>
<p>Highlight <code>TODO</code>, <code>FIXME</code> and other annotations within your code.</p>
<p>Sometimes you forget to review the TODOs you've added while coding before you publish the code to production. So I've been wanting an extension for a long time that highlights them and reminds me that there are notes or things not done yet.</p>
<p>Hope this extension helps you as well.</p>
<p><strong>Download -</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=wayou.vscode-todo-highlight"><strong>TODO Highlight</strong></a></p>
<p><img src="https://github.com/wayou/vscode-todo-highlight/raw/master/assets/material-night.png" alt="TODO Highlight" /></p>
<h3 id="heading-turbo-console-log">Turbo Console Log</h3>
<p>Automating the process of writing meaningful log messages.</p>
<p><strong>Download -</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=ChakrounAnas.turbo-console-log"><strong>Turbo Console Log</strong></a></p>
<p><img src="https://image.ibb.co/dysw7p/insert_log_message.gif" alt="Turbo Console Log" /></p>
<h3 id="heading-tabnine-ai">Tabnine AI</h3>
<p>Tabnine is an AI code assistant that makes you a better developer. Tabnine will increase your development velocity with real-time code completions in all the most popular coding languages and IDEs.</p>
<p><strong>Download -</strong> <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=TabNine.tabnine-vscode"><strong>Tabnine AI</strong></a></p>
<p><img src="https://raw.githubusercontent.com/codota/tabnine-vscode/master/assets/completions-main.gif" alt="Tabnine AI" /></p>
<h2 id="heading-settings">⚙️Settings</h2>
<p>The following <code>JSON</code> code shows my vs code setting:</p>
<pre><code class="lang-json"><span class="hljs-comment">// user/settings.json</span>
{
  <span class="hljs-attr">"files.autoSave"</span>: <span class="hljs-string">"afterDelay"</span>,
  <span class="hljs-attr">"editor.mouseWheelZoom"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"code-runner.clearPreviousOutput"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"code-runner.ignoreSelection"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"code-runner.runInTerminal"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"code-runner.saveAllFilesBeforeRun"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"code-runner.saveFileBeforeRun"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"editor.wordWrap"</span>: <span class="hljs-string">"on"</span>,
  <span class="hljs-attr">"C_Cpp.updateChannel"</span>: <span class="hljs-string">"Insiders"</span>,
  <span class="hljs-attr">"editor.suggestSelection"</span>: <span class="hljs-string">"first"</span>,
  <span class="hljs-attr">"python.jediEnabled"</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"editor.fontSize"</span>: <span class="hljs-number">17</span>,
  <span class="hljs-attr">"emmet.includeLanguages"</span>: {
    <span class="hljs-attr">"javascript"</span>: <span class="hljs-string">"javascriptreact"</span>
  },
  <span class="hljs-attr">"editor.minimap.size"</span>: <span class="hljs-string">"fit"</span>,
  <span class="hljs-attr">"editor.fontFamily"</span>: <span class="hljs-string">"Consolas, DejaVu Sans Mono, monospace"</span>,
  <span class="hljs-attr">"editor.fontLigatures"</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"[html]"</span>: {
    <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"esbenp.prettier-vscode"</span>
  },
  <span class="hljs-attr">"python.formatting.provider"</span>: <span class="hljs-string">"yapf"</span>,
  <span class="hljs-attr">"[css]"</span>: {
    <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"esbenp.prettier-vscode"</span>
  },
  <span class="hljs-attr">"git.autofetch"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"git.enableSmartCommit"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"html-css-class-completion.enableEmmetSupport"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"editor.formatOnPaste"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"liveServer.settings.donotShowInfoMsg"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"[python]"</span>: {
    <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"ms-python.python"</span>
  },
  <span class="hljs-attr">"diffEditor.ignoreTrimWhitespace"</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"[json]"</span>: {
    <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"vscode.json-language-features"</span>
  },
  <span class="hljs-attr">"[c]"</span>: {
    <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"ms-vscode.cpptools"</span>
  },
  <span class="hljs-attr">"editor.fontWeight"</span>: <span class="hljs-string">"300"</span>,
  <span class="hljs-attr">"editor.fastScrollSensitivity"</span>: <span class="hljs-number">6</span>,
  <span class="hljs-attr">"explorer.confirmDragAndDrop"</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"vsicons.dontShowNewVersionMessage"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"workbench.iconTheme"</span>: <span class="hljs-string">"material-icon-theme"</span>,
  <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"esbenp.prettier-vscode"</span>,
  <span class="hljs-attr">"editor.renderWhitespace"</span>: <span class="hljs-string">"none"</span>,
  <span class="hljs-attr">"workbench.startupEditor"</span>: <span class="hljs-string">"newUntitledFile"</span>,
  <span class="hljs-attr">"liveServer.settings.multiRootWorkspaceName"</span>: <span class="hljs-string">""</span>,
  <span class="hljs-attr">"liveServer.settings.port"</span>: <span class="hljs-number">5000</span>,
  <span class="hljs-attr">"liveServer.settings.donotVerifyTags"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"editor.formatOnSave"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"html.format.indentInnerHtml"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"editor.formatOnType"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"printcode.tabSize"</span>: <span class="hljs-number">4</span>,
  <span class="hljs-attr">"terminal.integrated.confirmOnExit"</span>: <span class="hljs-string">"hasChildProcesses"</span>,
  <span class="hljs-attr">"terminal.integrated.cursorBlinking"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"terminal.integrated.rightClickBehavior"</span>: <span class="hljs-string">"default"</span>,
  <span class="hljs-attr">"tailwindCSS.emmetCompletions"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"sync.gist"</span>: <span class="hljs-string">"527c3e29660c53c3f17c32260188d66d"</span>,
  <span class="hljs-attr">"gitlens.hovers.currentLine.over"</span>: <span class="hljs-string">"line"</span>,
  <span class="hljs-attr">"terminal.integrated.profiles.windows"</span>: {
    <span class="hljs-attr">"PowerShell"</span>: {
      <span class="hljs-attr">"source"</span>: <span class="hljs-string">"PowerShell"</span>,
      <span class="hljs-attr">"icon"</span>: <span class="hljs-string">"terminal-powershell"</span>
    },
    <span class="hljs-attr">"Command Prompt"</span>: {
      <span class="hljs-attr">"path"</span>: [
        <span class="hljs-string">"${env:windir}\\Sysnative\\cmd.exe"</span>,
        <span class="hljs-string">"${env:windir}\\System32\\cmd.exe"</span>
      ],
      <span class="hljs-attr">"args"</span>: [],
      <span class="hljs-attr">"icon"</span>: <span class="hljs-string">"terminal-cmd"</span>
    },
    <span class="hljs-attr">"Git Bash"</span>: {
      <span class="hljs-attr">"source"</span>: <span class="hljs-string">"Git Bash"</span>
    },
    <span class="hljs-attr">"C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe (migrated)"</span>: {
      <span class="hljs-attr">"path"</span>: <span class="hljs-string">"C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"</span>,
      <span class="hljs-attr">"args"</span>: []
    },
    <span class="hljs-attr">"Windows PowerShell"</span>: {
      <span class="hljs-attr">"path"</span>: <span class="hljs-string">"C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"</span>
    },
    <span class="hljs-attr">"Ubuntu (WSL)"</span>: {
      <span class="hljs-attr">"path"</span>: <span class="hljs-string">"C:\\WINDOWS\\System32\\wsl.exe"</span>,
      <span class="hljs-attr">"args"</span>: [
        <span class="hljs-string">"-d"</span>,
        <span class="hljs-string">"Ubuntu"</span>
      ]
    }
  },
  <span class="hljs-attr">"javascript.updateImportsOnFileMove.enabled"</span>: <span class="hljs-string">"always"</span>,
  <span class="hljs-attr">"[dotenv]"</span>: {
    <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"foxundermoon.shell-format"</span>
  },
  <span class="hljs-attr">"editor.tabSize"</span>: <span class="hljs-number">2</span>,
  <span class="hljs-attr">"cSpell.customDictionaries"</span>: {
    <span class="hljs-attr">"custom-dictionary-user"</span>: {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"custom-dictionary-user"</span>,
      <span class="hljs-attr">"path"</span>: <span class="hljs-string">"~/.cspell/custom-dictionary-user.txt"</span>,
      <span class="hljs-attr">"addWords"</span>: <span class="hljs-literal">true</span>,
      <span class="hljs-attr">"scope"</span>: <span class="hljs-string">"user"</span>
    }
  },
  <span class="hljs-attr">"window.restoreFullscreen"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"tabnine.experimentalAutoImports"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"files.defaultLanguage"</span>: <span class="hljs-string">"${activeEditorLanguage}"</span>,
  <span class="hljs-attr">"bracket-pair-colorizer-2.depreciation-notice"</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"workbench.editor.wrapTabs"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"[markdown]"</span>: {
    <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"esbenp.prettier-vscode"</span>
  },
  <span class="hljs-attr">"[ignore]"</span>: {
    <span class="hljs-attr">"editor.defaultFormatter"</span>: <span class="hljs-string">"foxundermoon.shell-format"</span>
  },
  <span class="hljs-attr">"terminal.integrated.fontFamily"</span>: <span class="hljs-string">"courier new"</span>,
  <span class="hljs-attr">"terminal.integrated.defaultProfile.windows"</span>: <span class="hljs-string">"pwsh.exe -nologo"</span>,
  <span class="hljs-attr">"terminal.integrated.shellIntegration.enabled"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"terminal.integrated.shellIntegration.showWelcome"</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"editor.accessibilitySupport"</span>: <span class="hljs-string">"off"</span>,
  <span class="hljs-attr">"editor.bracketPairColorization.enabled"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"todohighlight.isEnable"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"terminal.integrated.shellIntegration.history"</span>: <span class="hljs-number">1000</span>,
  <span class="hljs-attr">"turboConsoleLog.insertEnclosingClass"</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"turboConsoleLog.insertEnclosingFunction"</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"files.autoSaveDelay"</span>: <span class="hljs-number">500</span>,
  <span class="hljs-attr">"liveServer.settings.CustomBrowser"</span>: <span class="hljs-string">"chrome"</span>,
  <span class="hljs-attr">"liveServer.settings.host"</span>: <span class="hljs-string">"localhost"</span>,
  <span class="hljs-attr">"liveServer.settings.fullReload"</span>: <span class="hljs-literal">true</span>,
  <span class="hljs-attr">"workbench.editor.enablePreview"</span>: <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"workbench.colorTheme"</span>: <span class="hljs-string">"Andromeda Bordered"</span>
}
</code></pre>
<h2 id="heading-wrapping-up">Wrapping up</h2>
<p>This is all. I hope you find this useful. If you do, then don't forget to give ❤️ and Bookmark 🏷️ for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<ul>
<li><p><a target="_blank" href="https://twitter.com/j471n_">Twitter</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/j471n">GitHub</a></p>
</li>
<li><p><a target="_blank" href="https://www.linkedin.com/in/j471n/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://instagram.com/j471n_">Instagram</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.in">Website</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.substack.com/">Newsletter</a></p>
</li>
<li><p><a target="_blank" href="https://www.buymeacoffee.com/j471n">Buy me a coffee</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Chrome Extensions of the Month - January  2023]]></title><description><![CDATA[In this article, I will suggest to you some of the best extensions you need to install for better productivity that can come in very handy. So without further due, let's get into it.
ChatGPT for Google
ChatGPT for Google displays ChatGPT response alo...]]></description><link>https://hashnode.j471n.in/chrome-extensions-of-the-month-january-2023</link><guid isPermaLink="true">https://hashnode.j471n.in/chrome-extensions-of-the-month-january-2023</guid><category><![CDATA[chrome extension]]></category><category><![CDATA[Chrome Extensions of the Month]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Tue, 31 Jan 2023 05:30:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674865251586/5d65a4c8-1b25-4786-a025-7df5a1dde01f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>In this article, I will suggest to you some of the best extensions you need to install for better productivity that can come in very handy. So without further due, let's get into it.</em></p>
<h2 id="heading-chatgpt-for-google">ChatGPT for Google</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/chatgpt-for-google/jgjaeacdkonaoafenlfkkkmbaopkbilf">ChatGPT for Google</a> displays ChatGPT response alongside search engine results This is an open-source extension that shows the response from ChatGPT alongside Google, Bing, DuckDuckGo and other search engines</p>
<p><strong>Features:</strong></p>
<ul>
<li><p>Supports all popular search engines</p>
</li>
<li><p>Access ChatGPT from the extension popup</p>
</li>
<li><p>Markdown rendering</p>
</li>
<li><p>Code highlights</p>
</li>
<li><p>Dark mode</p>
</li>
<li><p>Feedback to improve ChatGPT</p>
</li>
<li><p>Custom trigger mode</p>
</li>
<li><p>Copy to clipboard</p>
</li>
</ul>
<p><img src="https://i.imgur.com/XuvoSvm.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-summarize">Summarize</h2>
<p>With the <a target="_blank" href="https://chrome.google.com/webstore/detail/summarize/lmhkmibdclhibdooglianggbnhcbcjeh">Summarize</a> extension, you can get the main ideas of any page in just one click, without leaving the page. Whether you're reading news, articles, blogs, or research reports, Summarize have you covered.</p>
<p><img src="https://lh3.googleusercontent.com/B0l-_JbAcYsmMqLSmffyrr0DTpn7I-0-T_0A01uyIU-ofN3YSxt86NNrJecOmxqvMHwaM7igxQBxNEuTn45H6QrwuHY=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<h2 id="heading-flonnect">Flonnect</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/screen-webcam-recorder-fl/lkeokcighogdliiajgbbdjibidaaeang">Flonnect</a> extensions allow Screen Recording from your Webcam and Desktop Record your screen or camera along with your audio. This extension supports all types of screen recordings for free with unlimited usage.</p>
<ul>
<li><p>Free to Use</p>
</li>
<li><p>No Watermark</p>
</li>
<li><p>No Lag screen recording</p>
</li>
<li><p>Unlimited Usage</p>
</li>
<li><p>Includes audio recording with Webcam</p>
</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/5Pe5nDOoCp5LMQlPOpuJph5cpYTi_H2WwLZ3_jSO4tBGrbXlw77XmfadEg9mqqPrznVzEs1XSIkSMs8g-rcJLsBSkg=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<h2 id="heading-hackertab">Hackertab</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/hackertabdev-developer-ne/ocoipcahhaedjhnpoanfflhbdcpmalmp">Hackertab</a> allows you to customize your default tab page that includes news, tools and events from top sources such as GitHub Trendings, Hacker News, DevTo, Medium, and Product Hunt. No matter what type of developer you are, you'll find valuable and relevant information here.</p>
<p><img src="https://lh3.googleusercontent.com/rQiOXCi1evWhjOOOCaoM5hWmE3RUMbKqaqcV70Jf0VCAzH5pkAUsYcvRqFMzdNjg8UsJP9P0f9VYQ32eppTtTHo8YQ=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<h2 id="heading-superdev">SuperDev</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/superdev-design-and-dev-t/jlkikimlceonbmfjieipbonnglnlchhl">SuperDev</a> is a browser toolbox for designers, developers and techies that minimizes the development/designing time and provides various tools to debug the web without any hassle. It contains 18 tools for developers so you won't have to install a separate extension for each one.</p>
<p><img src="https://lh3.googleusercontent.com/ALEstpr8U-EHKVwsvkkPW6Qz5CU5s61gVaICjoTQf8gcCHYiPpmEg4CrnTmB9CxIshkOUwMXkly_JIMnH6eJ-OIyV2o=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<p><img src="https://lh3.googleusercontent.com/X35Vh8GIh3SQ6dkgEDpRLHPbWrMx3vA7MGXrhUuBVKrQ56a-Kum9Xye8tMINePOram94F73yJYuie84QHszQ8EQ7=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<h2 id="heading-github-writer">GitHub Writer</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/github-writer/diilnnhpcdjhhkjcbdljaonhmhapadap">GitHub Writer</a> provides all the features available in the GitHub plain-text editor, including Markdown input. For features like tables, it offers a much easier experience in comparison to plain-text Markdown and allows users to be more productive. No more switching to the Preview tab to see what you write!</p>
<p><img src="https://lh3.googleusercontent.com/f1pqeSNUeStwkah579AzvJqU6T9TxtaUGePWtSdMVrSSN-08dZdJrog10t3ZLJmX_-8OcDUTDrtyoEgvhX7HKJPL=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<h2 id="heading-querio">Querio</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/querio-graphql-and-xhr-re/ojealanebldmhejpndmaenfcdpengbac">Querio</a> adds the Missing DevTools network inspector for GraphQL and XHR requests.</p>
<ul>
<li><p>Querio intercepts and displays GraphQL and XHR requests in a nicer and more dev-friendly way than the built-in Network panel</p>
</li>
<li><p>Each request made on the page is beautifully formatted and highlighted</p>
</li>
<li><p>Search data in request/response</p>
</li>
<li><p>Filtering by request type and searching by GraphQL query/mutation name</p>
</li>
<li><p>Dark and Light themes</p>
<p>  <img src="https://lh3.googleusercontent.com/Pb-yfu0uUl3jQs6KWY8ccVQyy0u-VRt0xcsPgTdoLcciRnIzMmVGto7XeWHatXRNeb1vKVXptK1YDjYO4CIfY9EdOg=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/xovxnw6CzIso_AZ5RfvNYJosiEYtF5lpqXQOy0KW8KofQoLOhxPOSH5IgrAx1Y16XwLl5VJipDEuPrfbi4yq3cXmRro=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<h2 id="heading-little-star">Little Star</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/little-star-github-stars/kmjfdonmflchjdlmeoecbmebfpnafpec">Little Star</a> comes from the idea of categorizing projects directly when clicking the GitHub Star button, and I want to manage and local my GitHub stars quickly. So building a browser extension with a comfortable UI comes to my mind.</p>
<p><img src="https://lh3.googleusercontent.com/3-RkCO-KK-QDEio1zGeok03P7d9BuN7tTdfwDVZfdTwOm3lmj3qgODOkIFEvpGPU-X7BtwBCK3i9ko9z-An63sw00A=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<p><img src="https://lh3.googleusercontent.com/bgytldKRmvrJ3r7fVmfd1C1ZVGVFLJZUtE-ZGsV9yO-UAUnRl2vrM-9x3dqCscu-rIHuZeeVBSbSWS6Zkm19-Y-Bdg=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<h2 id="heading-you">You</h2>
<p>Search less, find and create more with generative AI apps supercharging your search and helping you write better, code better, and design better. <a target="_blank" href="https://chrome.google.com/webstore/detail/youcom-search-chat-and-cr/fhplnehgjpmohhldfnjhibanpbiedofi">You.com</a> has a beautiful and modern UI. Quickly access generative AI apps powered by OpenAI models (such as GPT-3).</p>
<p><img src="https://lh3.googleusercontent.com/7iFUe_ac5FxWhSqBptLVgSDhHt4TebpzJ40rUgoQMUEH-Oi9Lnan9s1AOLHAEvMPZc2khiVGfej84qsaYBr3z3j-1tY=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<p><img src="https://lh3.googleusercontent.com/5QQnng5TESoRGefTWxhF6ENSIcdBO8LYjJZeB7_wVkxLXqRv31UIptebAzU5lY8a5dQD1VBX67ewMlpaALM4qVtQ5g=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<h2 id="heading-ocr-editor">OCR Editor</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/ocr-editor-text-from-imag/ihnfmldlpdipgnliolhfffenpcmjgnif/related">OCR text extractor</a>, or image-to-text converter extracts text from images and videos. It uses optical character recognition (OCR) technology to accurately convert images into text. It supports text extraction from all the images.</p>
<p><img src="https://lh3.googleusercontent.com/NZFyEnSuY8wMNUlTAoD3gPIyRjYPkXbsCkUq2UbhU4vRi5ofz6FkAVcf42lKR98TwCPA-hysPG73toYbe3bQeCMZLZ0=w640-h400-e365-rj-sc0x00ffffff" alt class="image--center mx-auto" /></p>
<hr />
<h2 id="heading-wrapping-up"><strong>Wrapping up</strong></h2>
<p>These were some extensions for this month (January 2023). You might have heard some before, but if you like anyone then don't forget to press ❤️. I have personally used all the above extensions and from my experience, every extension is worth installing.</p>
]]></content:encoded></item><item><title><![CDATA[Typescript: Type Aliases and Union]]></title><description><![CDATA[In this article, you will learn about Type Aliases and how you can define your own types in typescript and use that in functions or classes as well. Along with Type Aliases, I have also explained how you can use Union to create multiple type variable...]]></description><link>https://hashnode.j471n.in/typescript-type-aliases-and-union</link><guid isPermaLink="true">https://hashnode.j471n.in/typescript-type-aliases-and-union</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Tue, 24 Jan 2023 12:30:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674541744520/7c46d0d8-ae89-4f1d-8b7d-5ab388eeb91f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, you will learn about Type Aliases and how you can define your own types in typescript and use that in functions or classes as well. Along with Type Aliases, I have also explained how you can use Union to create multiple type variables which means that one variable can have multiple types at once.</p>
<blockquote>
<p>This is going to be a full series of typescript where you will learn from basic topics like string, boolean to more complex like Type Aliases, enums, Interface, generics, etc.</p>
</blockquote>
<h2 id="heading-type-aliases">Type Aliases</h2>
<p>We can use the objects as shown in the previous example but what if there are 100s of functions that need the same data of the user then you'll be typing for all of them separately that's where <strong>Type</strong> comes into play. Let's look at the old example and how we can use <code>type</code> to make it reusable.</p>
<pre><code class="lang-ts"><span class="hljs-keyword">type</span> User = {
  email: <span class="hljs-built_in">string</span>;
  password: <span class="hljs-built_in">string</span>;
};

<span class="hljs-comment">// ✅ CORRECT</span>
<span class="hljs-comment">// Passsing Object Type Aliases</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">signUp</span>(<span class="hljs-params">user: User</span>)</span>{}

<span class="hljs-comment">// ✅ It's the correct way to call</span>
signUp({email: <span class="hljs-string">"some@hello.com"</span>, password: <span class="hljs-string">"1233"</span>})

<span class="hljs-comment">// ❌ ERROR : 'name' does not exist in type 'User'</span>
signUp({email: <span class="hljs-string">"some@hello.com"</span>, password: <span class="hljs-string">"1233"</span>, name: <span class="hljs-string">"Sam"</span>})

<span class="hljs-comment">// ✅ You can pass extra information by using a variable</span>
<span class="hljs-keyword">let</span> userObj =  {email:  <span class="hljs-string">"some@hello.com"</span>, password:  <span class="hljs-string">"1233"</span>, name:  <span class="hljs-string">"Sam"</span>}
signUp(userObj)
</code></pre>
<p>You can use a type alias to give a name to any type at all, not just an object type. For example:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">type</span> ID = <span class="hljs-built_in">number</span>;
<span class="hljs-keyword">let</span> userId: ID = <span class="hljs-number">111</span>; <span class="hljs-comment">// ✅ CORRECT</span>
</code></pre>
<p>I guess you get the point that we use <code>type</code> to define the actual type of the variable. It can be used anywhere.</p>
<h3 id="heading-readonly-and-optional">Readonly and Optional</h3>
<p><strong>readonly</strong> means that the user or anyone cannot manipulate that variable, for example <code>id</code> <strong>optional</strong> means that these parameters are optional which we have looked at before in functions.</p>
<p>Let's take an example of <code>User</code> where the user will have three properties <code>id</code>, <code>email</code>, and <code>name</code>.</p>
<pre><code class="lang-typescript"><span class="hljs-comment">// Defining the User type</span>
<span class="hljs-keyword">type</span> User = {
    <span class="hljs-keyword">readonly</span> id : <span class="hljs-built_in">string</span>,
    name: <span class="hljs-built_in">string</span>,
    email: <span class="hljs-built_in">string</span>,
}

<span class="hljs-comment">// Now Let's create a user variable using the above type:</span>
<span class="hljs-keyword">let</span> myUser:User = {
    id : <span class="hljs-string">"3947394"</span>,
    name: <span class="hljs-string">"harry"</span>,
    email: <span class="hljs-string">"h@harry.com"</span>,
}

<span class="hljs-comment">// Now I'll assign the values to the myUser object</span>

<span class="hljs-comment">// ✅ CORRECT</span>
myUser.name = <span class="hljs-string">"Potter"</span>;
myUser.email = <span class="hljs-string">"hello@harry.com"</span>;

<span class="hljs-comment">// ❌ ERROR: Cannot assign to 'id' because it is a read-only property</span>
myUser.id = <span class="hljs-string">"121324"</span>;
</code></pre>
<p>Now, let's take a look at the optional:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// Defining the User type</span>
<span class="hljs-keyword">type</span> User = {
    <span class="hljs-keyword">readonly</span> id : <span class="hljs-built_in">string</span>,
    name: <span class="hljs-built_in">string</span>,
    email: <span class="hljs-built_in">string</span>,
    dob?: <span class="hljs-built_in">string</span>     <span class="hljs-comment">// optional</span>
}

<span class="hljs-comment">// ✅ CORRECT</span>
<span class="hljs-keyword">let</span> user1: User = {
    id : <span class="hljs-string">"3947394"</span>,
    name: <span class="hljs-string">"harry"</span>,
    email: <span class="hljs-string">"h@harry.com"</span>,
    dob: <span class="hljs-string">"02/12/1998"</span>
}

<span class="hljs-comment">// ✅ CORRECT</span>
<span class="hljs-keyword">let</span> user2: User = {
    id : <span class="hljs-string">"3947394"</span>,
    name: <span class="hljs-string">"harry"</span>,
    email: <span class="hljs-string">"h@harry.com"</span>,
}
</code></pre>
<h3 id="heading-intersection-in-type">Intersection in <code>type</code></h3>
<p>You can combine two or more types using <code>&amp;</code>. You can do that as shown in the following code:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">type</span> User = {
    <span class="hljs-keyword">readonly</span> id : <span class="hljs-built_in">string</span>,
    name: <span class="hljs-built_in">string</span>,
    email: <span class="hljs-built_in">string</span>,
}

<span class="hljs-keyword">type</span> Admin = User &amp; {
    key: <span class="hljs-built_in">string</span>, 
}

<span class="hljs-comment">// You can use Admin like this:</span>
<span class="hljs-keyword">let</span> newAdmin: Admin = {
  id: <span class="hljs-string">"3KD5D874"</span>,
  name: <span class="hljs-string">"Lucifer"</span>,
  email: <span class="hljs-string">"lucifer@hell.com"</span>,
  key: <span class="hljs-string">"Oh my me!"</span>,
};
</code></pre>
<p>Now <code>Admin</code> will have <code>User</code> properties as well as shown in the above code.</p>
<h3 id="heading-type-aliases-in-functions">Type Aliases in Functions</h3>
<p>As I have defined multiple types in the above code. These are the custom type that you can even use in functions in form of Parameters or Return Values. You just need to define the <code>type</code> and then pass it as the parameter.</p>
<p><strong>Type Aliases as a function parameter</strong></p>
<pre><code class="lang-typescript"> <span class="hljs-keyword">type</span> User = {
    name: <span class="hljs-built_in">string</span>,
    email: <span class="hljs-built_in">string</span>,
    password: <span class="hljs-built_in">string</span>, 
}
<span class="hljs-comment">// You can use optional variables as well </span>

<span class="hljs-comment">// Function that will add user to the database</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">addUser</span>(<span class="hljs-params">user: User</span>)</span>{
    <span class="hljs-comment">// do some database opertion</span>
}


<span class="hljs-comment">// ❌ ERROR:  Property 'password' is missing in type '{ name: string; email: string; }' but required in type 'User'</span>
addUser({name: <span class="hljs-string">"Rao"</span>, email: <span class="hljs-string">"rao@gmail.com"</span>)
<span class="hljs-comment">// ✅ CORRECT</span>
addUser({name: <span class="hljs-string">"Rao"</span>, email: <span class="hljs-string">"rao@gmail.com"</span>, password: <span class="hljs-string">"12345678"</span>})
</code></pre>
<p><strong>Type Aliases as a function return value</strong></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">type</span> User = {
    _id: <span class="hljs-built_in">string</span> 
    name: <span class="hljs-built_in">string</span>,
    email: <span class="hljs-built_in">string</span>,
}

<span class="hljs-comment">// ✅ CORRECT</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">loginUser</span>(<span class="hljs-params">id: <span class="hljs-built_in">string</span></span>): <span class="hljs-title">User</span> </span>{
    <span class="hljs-comment">// performing some operation</span>
    <span class="hljs-keyword">return</span> {_id: id, name: <span class="hljs-string">"Joe"</span>, email:<span class="hljs-string">"joe@gmail.com"</span>}
}

<span class="hljs-comment">// ❌ ERROR: Property 'email' is missing</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">loginUser</span>(<span class="hljs-params">id: <span class="hljs-built_in">string</span></span>): <span class="hljs-title">User</span> </span>{
    <span class="hljs-comment">// performing some operation</span>
    <span class="hljs-keyword">return</span> {_id: id, name: <span class="hljs-string">"Joe"</span>}
}
</code></pre>
<h2 id="heading-union">Union</h2>
<p>In Typescript, you can define more than one type of variable. You can do that by just putting (<code>|</code>) in the middle of two types. Let me show you what I am saying:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> id: <span class="hljs-built_in">string</span> | <span class="hljs-built_in">number</span>;

id = <span class="hljs-number">123</span>;             <span class="hljs-comment">// ✅</span>
id = <span class="hljs-string">"34398493"</span>;    <span class="hljs-comment">// ✅</span>
</code></pre>
<p>Both the example shown in the above code is correct. Let's take a little more complex example to understand how it works:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">type</span> User = {
    name: <span class="hljs-built_in">string</span>,
    id : <span class="hljs-built_in">number</span>
}

<span class="hljs-keyword">type</span> Admin ={
    username: <span class="hljs-built_in">string</span>,
    id: <span class="hljs-built_in">number</span>,
    key: <span class="hljs-built_in">number</span>,
}

<span class="hljs-keyword">let</span> newUser : User | Admin;

<span class="hljs-comment">// ✅ CORRECT</span>
newUser = {name: <span class="hljs-string">"John"</span>, id: <span class="hljs-number">123</span>};
newUser = {username : <span class="hljs-string">"j333"</span>, id : <span class="hljs-number">123</span>, key: <span class="hljs-number">345</span>};
newUser = {name: <span class="hljs-string">"j333"</span>, id : <span class="hljs-number">123</span>, key: <span class="hljs-number">345</span>};

<span class="hljs-comment">// ❌ ERROR: Property 'key' is missing</span>
newUser = {username : <span class="hljs-string">"j333"</span>, id : <span class="hljs-number">123</span>};
</code></pre>
<h3 id="heading-union-in-functions">Union in Functions</h3>
<p>You can also use these with function parameters as shown below:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// ✅ It works and id have string and number type</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">setUserId</span>(<span class="hljs-params">id: <span class="hljs-built_in">string</span> | <span class="hljs-built_in">number</span></span>)</span>{
    <span class="hljs-built_in">console</span>.log(id);
}

<span class="hljs-comment">// ❌ ERROR : </span>
<span class="hljs-comment">// What if we do like this:</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">setUserId</span>(<span class="hljs-params">id: <span class="hljs-built_in">string</span> | <span class="hljs-built_in">number</span> </span>)</span>{
    id.toLowerCase()  <span class="hljs-comment">// ❌ ERROR: Property 'toLowerCase' does not exist on type 'number</span>
}
</code></pre>
<p>Now the above code will show you an error because <code>id</code> has two types <code>string</code> and <code>number.</code> The string can be converted to lowercase but the number can't. That's why it is showing you the error. You can use the conditional statement to do your desired stuff. Such as:</p>
<pre><code class="lang-ts"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">setUserId</span>(<span class="hljs-params">id: <span class="hljs-built_in">string</span> | <span class="hljs-built_in">number</span> </span>)</span>{
    <span class="hljs-keyword">if</span> (id === <span class="hljs-string">"string"</span>) {
        id.toLowerCase()
    }
    <span class="hljs-comment">// do other things</span>
}
</code></pre>
<p>Now it won't give you any errors because we are making sure that <code>toLowerCase()</code> only calls when the <code>id</code> is a string.</p>
<h3 id="heading-union-in-array">Union in Array</h3>
<p>In the array section, we discussed that we can set an array type with two methods. But the issue with that is What if we want an array that has multiple types of values such as <code>string</code> and <code>number</code> then what do we do? The answer is Union. Now let's take a look at how you do it:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// You might be thinking like this</span>
<span class="hljs-comment">// Nah ❌ you can't do like that</span>
<span class="hljs-keyword">let</span> newArray: <span class="hljs-built_in">number</span>[] | <span class="hljs-built_in">string</span>[] = [<span class="hljs-number">1</span>,<span class="hljs-number">2</span>, <span class="hljs-string">"hello"</span>];

<span class="hljs-comment">// ✅ Correct way to define the array with multiple type is:</span>
<span class="hljs-keyword">let</span> newArray: (<span class="hljs-built_in">number</span> | <span class="hljs-built_in">string</span>)[] = [<span class="hljs-number">1</span>,<span class="hljs-number">2</span>, <span class="hljs-string">"hello"</span>];
</code></pre>
<h3 id="heading-special-case-for-union">Special Case for Union</h3>
<p>Now imagine you are working on CSS Framework and you are designing a <code>Button</code>. And you are asking the user to tell what size should button have. Now you can use the variable type as <code>string</code> but the user can type anything, right? Let's understand this via an example:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// ❌ WRONG APPROACH</span>
<span class="hljs-keyword">let</span> ButtonSize: <span class="hljs-built_in">string</span>;

ButtonSize = <span class="hljs-string">"big"</span>;
ButtonSize = <span class="hljs-string">"medium"</span>;
ButtonSize = <span class="hljs-string">"don't know"</span>;  <span class="hljs-comment">// that's why don't use this</span>

<span class="hljs-comment">// ✅ CORRECT APPROACH</span>
<span class="hljs-keyword">let</span> ButtonSize : <span class="hljs-string">"sm"</span> | <span class="hljs-string">"md"</span> | <span class="hljs-string">"lg"</span> | <span class="hljs-string">"xl"</span>;

ButtonSize = <span class="hljs-string">"sm"</span>;
ButtonSize = <span class="hljs-string">"md"</span>;
ButtonSize = <span class="hljs-string">"lg"</span>;
ButtonSize = <span class="hljs-string">"xl"</span>;

<span class="hljs-comment">// ❌ ERROR: Type 'large' is not assignable to type</span>
ButtonSize = <span class="hljs-string">"large"</span>;
</code></pre>
<p>As you saw at the end of the above code the typescript restricts you from assigning <code>large</code> to <code>ButtonSize</code>. It only accepts special types defined by you for the button.</p>
<h2 id="heading-your-task">Your Task</h2>
<p>Now, It's your turn to create something. So, for that You have to create a type for a User that will have the following properties:</p>
<ul>
<li><p><strong>_id</strong>: a string representing a unique identifier for the user</p>
</li>
<li><p><strong>name</strong>: a string representing the user's name</p>
</li>
<li><p><strong>posts</strong>: an array of objects, each representing a post made by the user, with properties id, title, and body</p>
</li>
<li><p><strong>comments</strong>: an array of objects, each representing a comment made by the user, with properties id, postId, and body.</p>
</li>
</ul>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>In this article, I explained what is Type Aliases and how you can define your own types in typescript and use that in functions or classes as well. Along with Type Aliases, I have also explained how you can use Union to create multiple type variables which means that one variable can have multiple types at once.</p>
<p>This is a series of Typescript that will help you to learn Typescript from the scratch. If you enjoyed this article, then don't forget to give ❤️ and Bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<ul>
<li><p><a target="_blank" href="https://twitter.com/j471n_">Twitter</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/j471n">GitHub</a></p>
</li>
<li><p><a target="_blank" href="https://www.linkedin.com/in/j471n/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://instagram.com/j471n_">Instagram</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.in">Website</a></p>
</li>
<li><p><a target="_blank" href="https://j471n.substack.com/">Newsletter</a></p>
</li>
<li><p><a target="_blank" href="https://www.buymeacoffee.com/j471n">Buy me a coffee</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[10 Best Developer Swags for 2023]]></title><description><![CDATA[Hello, my fellow developers, This article will be a little different because in this article I will share 10 swags that you can buy for 2023. As we already know people like developer swag (I'm one of them).

I create this list for myself then I thoug...]]></description><link>https://hashnode.j471n.in/10-best-developer-swags-for-2023</link><guid isPermaLink="true">https://hashnode.j471n.in/10-best-developer-swags-for-2023</guid><category><![CDATA[Web Development]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Developer]]></category><category><![CDATA[programming]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Sun, 08 Jan 2023 13:11:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1673127381953/1dbca721-a12f-4d4f-98fd-432ebcc58453.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello, my fellow developers, This article will be a little different because in this article I will share 10 swags that you can buy for 2023. As we already know people like developer swag (I'm one of them).</p>
<p><img src="https://img.devrant.com/devrant/rant/r_1184468_5tyqe.jpg" alt="swag - When you are PHP developer but you go to Java conference - devRant" class="image--center mx-auto" /></p>
<p>I create this list for myself then I thought why don't I share it with you? Let's look at what swags I am talking about.</p>
<h2 id="heading-1-there-is-no-place-like-127001httpswwwdevshirtclubdeveloper-shirtthere-is-no-place-like-127-0-0-1">1. <a target="_blank" href="https://www.devshirt.club/developer-shirt/there-is-no-place-like-127-0-0-1"><strong>There is no place like 127.0.0.1</strong></a></h2>
<p>"There is no place like 127.0.0.1" means "There is no place like home". As most of you already know that <strong>127.0.0.1 is</strong> the loopback address, popularly termed <strong>localhost</strong>. Most of us use it daily for local development. Whether we're developing some front-end or some back-end web application, we'll visit it multiple times during the day. It will be released on <strong>February 1, 2023</strong> <em>(Limited Edition)</em>.</p>
<p><img src="https://uploads-ssl.webflow.com/622410f754c4b8cfc41e261d/636131b9188ecb2472a5171a_yes-cropped.jpeg" alt="There is no place like 127.0.0.1 | Developer t-shirt made for programmers" /></p>
<h2 id="heading-2-i-are-programmer-i-make-computer-beep-boophttpswwwdevshirtclubdeveloper-shirti-are-programmer-i-make-computer-beep-boop">2. <a target="_blank" href="https://www.devshirt.club/developer-shirt/i-are-programmer-i-make-computer-beep-boop"><strong>I are programmer I make computer beep boop</strong></a></h2>
<p>"Beep Boop" is a common catchphrase describing mechanical beings, often robots and droids. It was first widely used in the first Start wars movie (New Hope, 1977) by a robot r2-d2. Even though he was extremely skilled and intelligent, he wasn't able to talk, but only produce beep-boop sounds instead. Those sounds were understood by other robots like c3po. It will be released on <strong>February 1, 2023</strong> <em>(Limited Edition)</em>.</p>
<p><img src="https://uploads-ssl.webflow.com/622410f754c4b8cfc41e261d/63617058888d0ba2c564f6b2_dog-yes-cropped.jpg" alt="I are programmer I make computer beep boop boop | Developer t-shirt made for programmers" /></p>
<h2 id="heading-3-docker-saves-the-dayhttpswwwdevshirtclubdeveloper-shirtdocker-saves-the-day">3. <a target="_blank" href="https://www.devshirt.club/developer-shirt/docker-saves-the-day"><strong>Docker saves the day</strong></a></h2>
<p>Before there was docker we used to run various shell scripts to install the needed dependencies for our app. Docker's first open-source version was published in 2013, but to be fair, it didn't gain widespread adoption till around 2016. Docker was truly revolutionary for its time. Due to its virtualization layers, it was able to spin up containers in just a couple of seconds. If you have already used docker then go for this. It will be released on <strong>April 1, 2023</strong> <em>(Limited Edition)</em>.</p>
<p><img src="https://uploads-ssl.webflow.com/622410f754c4b8cfc41e261d/63989588e3d980c7316cd172_containers_cropped.jpeg" alt="Docker saves the day | Containers | Developers T-shirt" /></p>
<h2 id="heading-4-its-harder-to-read-code-than-to-write-ithttpswwwdevshirtclubdeveloper-shirtits-harder-to-read-code-than-to-write-it">4. <a target="_blank" href="https://www.devshirt.club/developer-shirt/its-harder-to-read-code-than-to-write-it">It's harder to read code than to write it</a></h2>
<p>We’re programmers, we build some amazing and complex things. But sometimes when you like someone else's build then you are curious how he did, he achieve that and then you look at their code. Sometimes it is easy to understand, but sometimes it goes above your head. Sometimes you can't even read your code (man.... what did I do?) That's why It's harder to read code than to write it.</p>
<p><img src="https://uploads-ssl.webflow.com/622410f754c4b8cfc41e261d/6314c9aec9476c16a10baa14_dog-no.jpeg" alt="Reading code is hard | It is harder to read code than write it | developers t-shirt" /></p>
<h2 id="heading-5-may-stack-overflow-be-with-youhttpswwwredbubblecomit-shirtstack-overflow-with-you-by-caldofran37563301ij6l0">5. <a target="_blank" href="https://www.redbubble.com/i/t-shirt/Stack-Overflow-with-you-by-Caldofran/37563301.IJ6L0">May Stack Overflow be with you</a></h2>
<p>Now it is funny because we take a lot of help from <a target="_blank" href="https://stackoverflow.com/">Stack Overflow</a> to find answers to technical questions or solutions to programming. It's like when you have some kind of error or bug just go to Stack Overflow. It's become a daily routine for developers.</p>
<p><img src="https://ih1.redbubble.net/image.869906908.3301/ssrco,classic_tee,flatlay,101010:01c5ca27c6,front,wide_portrait,750x1000.jpg" alt /></p>
<h2 id="heading-6-developer-vocabularyhttpscuttlyf2qlngi">6. <a target="_blank" href="https://cutt.ly/f2QLngI">Developer Vocabulary</a></h2>
<p>It's one of my favorite mugs which I'll be buying in 2023. If you know you know. A lot of developers say that the use of swearwords helps them get rid of stress, while others do it for fun or out of habit.</p>
<p><img src="https://i.etsystatic.com/27973304/r/il/583312/3673858008/il_794xN.3673858008_h5mt.jpg" alt="Vocabulary At Work Mug-Rude Developer Mug-Funny Developer image 1" /></p>
<h2 id="heading-7-minimalist-backpackhttpsstoredailydevcollectionsaccessoriesproductsminimalist-backpack-1">7. <a target="_blank" href="https://store.daily.dev/collections/accessories/products/minimalist-backpack-1"><strong>Minimalist Backpack</strong></a></h2>
<p>This swag is offered by daily.dev and I am looking forward to this backpack. It just looks so awesome to me. If you feel like you're carrying half of your belongings with you at all times, this backpack is for you! It has a spacious inside compartment (with a pocket for your laptop), and a hidden back pocket for safekeeping your most valuable items.</p>
<p><img src="https://cdn.shopify.com/s/files/1/0465/1476/5989/products/mockup-4933b413_860x.jpg?v=1598376998" alt="Minimalist Backpack" /></p>
<h2 id="heading-8-sticker-packhttpsshopforemcomcollections2018-new-merchproductssticker-pack">8. <a target="_blank" href="https://shop.forem.com/collections/2018-new-merch/products/sticker-pack"><strong>Sticker Pack</strong></a></h2>
<p>For a long time I want to get my hands on these sticker packs due to some circumstances, I wasn't able to get them last year. But this year, for sure, I'll buy them as soon as possible.</p>
<p><img src="https://cdn.shopify.com/s/files/1/1626/8507/products/Sticker_Collage_2019_1024x1024.png?v=1566402781" alt /></p>
<h2 id="heading-9-nextjs-t-shirthttpswwwredbubblecomit-shirtnext-js-the-react-framework-horizontal-logo-dark-mode-by-zombieoummy124684295fb110">9. <a target="_blank" href="https://www.redbubble.com/i/t-shirt/Next-js-The-React-Framework-Horizontal-Logo-Dark-Mode-by-zombieoummy/124684295.FB110">Next.js T-Shirt</a></h2>
<p>Next.js is my favorite web development framework and having a t-shirt of Next.js will be the best thing. I am definitely sure that this t-shirt will become one of my favorite purchases ever.</p>
<p><img src="https://ih1.redbubble.net/image.4176441464.4295/ssrco,classic_tee,flatlay,101010:01c5ca27c6,front,wide_portrait,750x1000.jpg" alt /></p>
<h2 id="heading-10-youth-invertocat-hoodiehttpswwwthegithubshopcomcollectionssale-2022productsyouth-invertocat-hoodie"><strong>10.</strong> <a target="_blank" href="https://www.thegithubshop.com/collections/sale-2022/products/youth-invertocat-hoodie"><strong>Youth Invertocat Hoodie</strong></a></h2>
<p>What would be the best hood in winter than GitHub's? Sometimes coding requires working in a cold environment so you need this to stay away from cold. I really this merch as well for my 2023 collection.</p>
<p><img src="https://cdn.shopify.com/s/files/1/0051/4802/products/Webshop_Hoodie_ZipUp_Youth_Invertocat_Black_v2_1_1_882x882.jpg?v=1670002690" alt="Youth Invertocat Hoodie" /></p>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>It was a fun article. Let me know what you think about these products. If you have any suggestions then let me know in the comment section. If you enjoyed this article, then don't forget to give ❤️ and Bookmark it 🏷️for later use. I'll see in the next one.</p>
<p><strong>References</strong></p>
<ul>
<li><p><a target="_blank" href="https://www.devshirt.club/">devshirt.club</a></p>
</li>
<li><p><a target="_blank" href="https://www.redbubble.com/">redbubble.com</a></p>
</li>
<li><p><a target="_blank" href="https://www.etsy.com/">etsy.com</a></p>
</li>
<li><p><a target="_blank" href="https://store.daily.dev/">store.daily.dev</a></p>
</li>
<li><p><a target="_blank" href="https://shop.forem.com/">shop.forem.com</a></p>
</li>
<li><p><a target="_blank" href="https://www.thegithubshop.com/">thegithubshop.com</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Typescript: Functions]]></title><description><![CDATA[In this article, we are going learn about How you can use typescript in functions. And How to restrict the function to take different types of values than define parameters. It will be a basic introduction to functions as we go in-depth in this serie...]]></description><link>https://hashnode.j471n.in/typescript-functions</link><guid isPermaLink="true">https://hashnode.j471n.in/typescript-functions</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Wed, 04 Jan 2023 02:41:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1672377008541/ac1148d2-9fff-4beb-9bfc-d5d278990e28.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, we are going learn about How you can use typescript in functions. And How to restrict the function to take different types of values than define parameters. It will be a basic introduction to functions as we go in-depth in this series you will learn so much more about functions such as How you can use Type Aliases or Interface to define custom types for Functions.</p>
<blockquote>
<p>This is going to be a full series of typescript where you will learn from basic topics like string, boolean to more complex like Type Aliases, enums, Interface, generics, and etc.</p>
</blockquote>
<h2 id="heading-functions">Functions</h2>
<p>Writing function is a piece of cake when you know the JS but it gets a little bit complex in typescript. Don’t worry, we will take every aspect of that. We need to define the types of two things in function <strong>Parameters</strong> &amp; <strong>Return Types.</strong></p>
<h3 id="heading-parameters">Parameters</h3>
<p>Function parameters are the names listed in the function's definition. I'll take an old example that I've mentioned before:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// This is a norma JS Function that take two number and returns the sum </span>
<span class="hljs-comment">// Problem is when you call the function you can pass any value </span>
<span class="hljs-comment">// It won't show error because the variable does not have any kind of type</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">increaseScore</span>(<span class="hljs-params">currentScore, increaseBy</span>)</span>{
    <span class="hljs-keyword">return</span> currentScore + increaseBy;
}

<span class="hljs-comment">// Now we define that both parameters have `number` type and it will only take the number</span>
<span class="hljs-comment">// otherwise it will throw an error</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">increaseScore</span>(<span class="hljs-params">currentScore: <span class="hljs-built_in">number</span>, increaseBy: <span class="hljs-built_in">number</span></span>) </span>{
  <span class="hljs-keyword">return</span> currentScore + increaseBy;
}
</code></pre>
<p>Following is an example of the error it will show when you pass the wrong value to the function:</p>
<pre><code class="lang-ts"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">increaseScore</span>(<span class="hljs-params">currentScore:<span class="hljs-built_in">number</span>, increaseBy:<span class="hljs-built_in">number</span></span>)</span>{
    <span class="hljs-built_in">console</span>.log(currentScore + increaseBy);
}

increaseScore(<span class="hljs-number">10</span>, <span class="hljs-number">2</span>) <span class="hljs-comment">// ✅ Correct</span>
increaseScore(<span class="hljs-number">10</span>,  <span class="hljs-string">"2"</span>);      <span class="hljs-comment">// ❌ Error</span>
increaseScore(<span class="hljs-number">10</span>,  [<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>])    <span class="hljs-comment">// ❌ Error</span>
</code></pre>
<h3 id="heading-return-types">Return Types</h3>
<p>Return types matter. Because In typescript there are many return types. For example, you already know <code>boolean</code>, <code>number</code> and <code>string</code>. But the question here is how we defined which type should return from the function. You can do that by the following syntax.</p>
<pre><code class="lang-ts"><span class="hljs-comment">// Syntax</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">funcName</span>(<span class="hljs-params">para: paraType</span>): <span class="hljs-title">returnType</span> </span>{
    <span class="hljs-comment">//........</span>
}


<span class="hljs-comment">// For Example:</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">greetings</span>(<span class="hljs-params">name: <span class="hljs-built_in">string</span></span>): <span class="hljs-title">string</span> </span>{
  <span class="hljs-keyword">return</span> <span class="hljs-string">"hello"</span> + name;
}

greetings(<span class="hljs-string">"john"</span>);    <span class="hljs-comment">// ✅</span>
greetings(<span class="hljs-literal">true</span>);     <span class="hljs-comment">// ❌ ERROR: Expected String</span>

<span class="hljs-comment">// greet is 'string' type because greetings() return stirng type</span>
<span class="hljs-keyword">let</span> greet = greetings(<span class="hljs-string">"Don"</span>);
greet = <span class="hljs-number">2</span>;     <span class="hljs-comment">// ❌ ERROR: because type is 'string'</span>
</code></pre>
<h3 id="heading-other-types">Other Types</h3>
<h4 id="heading-void">void</h4>
<p><code>void</code> represents the return value of functions that don’t return a value. It’s the inferred type any time a function doesn’t have any <code>return</code> statements or doesn’t return any explicit value from those return statements.</p>
<pre><code class="lang-ts"><span class="hljs-comment">// This function doesn't return anything thus its return type is void</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sayHi</span>(<span class="hljs-params">name: <span class="hljs-built_in">string</span></span>): <span class="hljs-title">void</span> </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Hi! "</span> + name);
}
</code></pre>
<h4 id="heading-never">never</h4>
<p>The <code>never</code> type represents values that are <em>never</em> observed. In a return type, this means that the function throws an exception or terminates the execution of the program.</p>
<pre><code class="lang-ts"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">handleError</span>(<span class="hljs-params">errMsg: <span class="hljs-built_in">string</span></span>): <span class="hljs-title">never</span> </span>{
  <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(errMsg);
}
</code></pre>
<p>There are a lot more other types you can take a look at the documentation for further use.</p>
<h3 id="heading-optional-parameters">Optional Parameters</h3>
<p>When you define parameters, sometimes you don't need to pass the parameters. So for that, you can add <code>?</code> next to the parameter as shown in the following code:</p>
<pre><code class="lang-ts"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">doSomething</span>(<span class="hljs-params">num?: <span class="hljs-built_in">number</span></span>) </span>{
  <span class="hljs-comment">// ...</span>
}
doSomething();      <span class="hljs-comment">// ✅ OK</span>
doSomething(<span class="hljs-number">10</span>);    <span class="hljs-comment">// ✅ OK</span>
</code></pre>
<blockquote>
<p><strong>Note:</strong> If you are using <code>num</code> as an optional parameter, and if you don't pass it as an argument, then it would be<code>undefined</code> by default. So, you can detect that by simply checking <code>(typeof num !== 'undefined')</code>.</p>
</blockquote>
<h3 id="heading-working-with-object">Working with Object</h3>
<p>In typescript working with objects could make you feel a little weird. Why? You will know why at the end of this section. There are many instances where you can use objects. Let's look at them one by one-</p>
<h4 id="heading-passing-object-as-parameter"><strong>Passing Object as Parameter</strong></h4>
<p>Passing an object as a Parameter could be a little tricky. You need to define the types of each property you are passing as shown in the following code:</p>
<pre><code class="lang-typescript"><span class="hljs-comment">// Destructuring an Object</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">signUp</span>(<span class="hljs-params">{email, password}: {email: <span class="hljs-built_in">string</span>, password: <span class="hljs-built_in">string</span>}</span>): <span class="hljs-title">void</span></span>{
    <span class="hljs-built_in">console</span>.log(email);
}

<span class="hljs-comment">// You can also define the signUp function like the following</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">signUp</span>(<span class="hljs-params">user: {email:  <span class="hljs-built_in">string</span>, password:  <span class="hljs-built_in">string</span>}</span>):  <span class="hljs-title">void</span></span>{
    <span class="hljs-built_in">console</span>.log(user.email);    
}

signUp();     <span class="hljs-comment">// ❌ ERROR: need to pass an object</span>
signUp({});   <span class="hljs-comment">// ❌ ERROR: to pass an object with email &amp; password ,</span>
signUp({email: <span class="hljs-string">"hello@gmail.com"</span>, password: <span class="hljs-string">"12345678"</span>}); <span class="hljs-comment">// ✅ Correct</span>
</code></pre>
<p>Now, what if you want to pass an object with more than these two parameters:</p>
<pre><code class="lang-ts"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">signUp</span>(<span class="hljs-params">user: { email: <span class="hljs-built_in">string</span>; password: <span class="hljs-built_in">string</span> }</span>): <span class="hljs-title">void</span> </span>{
  <span class="hljs-built_in">console</span>.log(user);
}

<span class="hljs-comment">// Passing name in the signUp function</span>
<span class="hljs-comment">// ❌ ERROR: 'name' does not exist</span>
signUp({ email: <span class="hljs-string">"hello@j471n.in"</span>, password: <span class="hljs-string">"12345678"</span>, name: <span class="hljs-string">"Johnny"</span> }); 


<span class="hljs-comment">// Creating a separate object and then passing it with the name</span>
<span class="hljs-comment">// ✅ Correct and No Error, But if you use 'name' in the signUp function then you'll get an error</span>
<span class="hljs-keyword">let</span> newUser = { email: <span class="hljs-string">"hello@j471n.in"</span>, password: <span class="hljs-string">"12345678"</span>, name: <span class="hljs-string">"Johnny"</span> };
signUp(newUser);
</code></pre>
<h4 id="heading-returning-object-from-function"><strong>Returning Object from Function</strong></h4>
<p>You can return an object through many ways from a function some of them are shown in the following code along with whether is it correct or not.</p>
<pre><code class="lang-ts"><span class="hljs-comment">// ❌ ERROR: A function whose declared type is neither 'void' nor 'any' must return a value</span>
<span class="hljs-comment">// As function needs to return an object with name &amp; age properties</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getInfo</span>(<span class="hljs-params"></span>):</span>{name:  <span class="hljs-built_in">string</span>, age:  <span class="hljs-built_in">number</span>}{}

<span class="hljs-comment">// ❌ ERROR: Property 'age' is missing</span>
<span class="hljs-comment">// Function must have all the properties as specified (name, age)</span>
<span class="hljs-comment">// And It only returns the name that's why it throws an error</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getInfo</span>(<span class="hljs-params"></span>):</span>{name: <span class="hljs-built_in">string</span>, age: <span class="hljs-built_in">number</span>}{
  <span class="hljs-keyword">return</span> {name: <span class="hljs-string">"John"</span>};
}

<span class="hljs-comment">// ✅ CORRECT </span>
<span class="hljs-comment">// No Error Because all the things are correct</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getInfo</span>(<span class="hljs-params"></span>):</span>{name: <span class="hljs-built_in">string</span>, age: <span class="hljs-built_in">number</span>}{
  <span class="hljs-keyword">return</span> {name: <span class="hljs-string">"John"</span>, age: <span class="hljs-number">29</span>};
}

<span class="hljs-comment">// ❌ ERROR: 'lastName' does not exist  </span>
<span class="hljs-comment">// As function should return only 'name' and 'age'</span>
<span class="hljs-comment">// And it returns 'lastName' too</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getInfo</span>(<span class="hljs-params"></span>):</span>{name: <span class="hljs-built_in">string</span>, age: <span class="hljs-built_in">number</span>}{
  <span class="hljs-keyword">return</span> {name: <span class="hljs-string">"John"</span>, age: <span class="hljs-number">29</span>, lastName: <span class="hljs-string">"Doe"</span>};
}

<span class="hljs-comment">// ✅ CORRECT </span>
<span class="hljs-comment">// You can assign an object to some variable and then return it </span>
<span class="hljs-comment">// Even if it has more properties as described</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getInfo</span>(<span class="hljs-params"></span>):</span>{name: <span class="hljs-built_in">string</span>, age: <span class="hljs-built_in">number</span>}{
  <span class="hljs-keyword">let</span> user = {name: <span class="hljs-string">"John"</span>, age: <span class="hljs-number">29</span>, lastName: <span class="hljs-string">"Doe"</span>}
  <span class="hljs-keyword">return</span> user;
}

<span class="hljs-comment">// ❌ ERROR: A function whose declared type is neither 'void' nor 'any' must return a value</span>
<span class="hljs-comment">// As you can see it has two {}</span>
<span class="hljs-comment">// First {} shows that it should return an object</span>
<span class="hljs-comment">// Second {} is function definition</span>
<span class="hljs-comment">// It should return an object</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getInfo</span>(<span class="hljs-params"></span>):</span>{}{}

<span class="hljs-comment">// ✅ CORRECT </span>
<span class="hljs-comment">// It returns and object that's why it works, It can have any properties because we haven't specified</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getInfo</span>(<span class="hljs-params"></span>):</span>{}{
  <span class="hljs-keyword">return</span> {name: <span class="hljs-string">"John"</span>}
}
</code></pre>
<p>The above code example might be scary to look at but we can achieve these things with Type Aliases as well. We'll look at it in the next article.</p>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>In this article, I explained How you can use typescript in functions. And How to restrict the function to take different types of values than define parameters. It will be a basic introduction to functions as we go in-depth in this series you will learn so much more about functions such as How you can use Type Aliases or Interface to define custom types for Functions.</p>
<p>This is a series of Typescript that will help you to learn Typescript from the scratch. If you enjoyed this article, then don't forget to give ❤️ and Bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Twitter</td><td>GitHub</td><td>LinkedIn</td><td>Instagram</td><td>Website</td><td>Newsletter</td><td>Support</td></tr>
</thead>
<tbody>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
</tbody>
</table>
</div>]]></content:encoded></item><item><title><![CDATA[Typescript: Types]]></title><description><![CDATA[In this article, we are going to learn about how we will use typescript to make sure that variable type is secure and no other value can manipulate that variable. For example: a string value cannot be assigned to a numeric variable.

This is going to...]]></description><link>https://hashnode.j471n.in/typescript-types</link><guid isPermaLink="true">https://hashnode.j471n.in/typescript-types</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Sat, 31 Dec 2022 12:30:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1672342496742/b0a9f8a8-0a39-4b2c-904e-073ef0d6c606.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, we are going to learn about how we will use typescript to make sure that variable type is secure and no other value can manipulate that variable. For example: a string value cannot be assigned to a numeric variable.</p>
<blockquote>
<p>This is going to be a full series of typescript where you will learn from basic topics like string, boolean to more complex like Type Aliases, enums, Interface, generics, and etc.</p>
</blockquote>
<h2 id="heading-types-in-typescript">Types in Typescript</h2>
<ul>
<li><p>number</p>
</li>
<li><p>string</p>
</li>
<li><p>boolean</p>
</li>
<li><p>null</p>
</li>
<li><p>undefined</p>
</li>
<li><p>void</p>
</li>
<li><p>object</p>
</li>
<li><p>array</p>
</li>
<li><p>tuples</p>
</li>
<li><p>unknown</p>
</li>
<li><p>never</p>
</li>
<li><p>any (should not use)</p>
</li>
</ul>
<p>and many more.</p>
<h3 id="heading-situations-to-use-typescript">Situations to use Typescript</h3>
<p>For example, there is a function <code>increaseScore</code> and it takes <code>currentScore</code> and increases the score by <code>increaseBy</code> number and returns the updated score.</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">increaseScore</span>(<span class="hljs-params">currentScore, increaseBy</span>)</span>{
    <span class="hljs-keyword">return</span> currentScore + increaseBy;
}

increaseScore(<span class="hljs-number">10</span>, <span class="hljs-number">2</span>) <span class="hljs-comment">// output : 12</span>
increaseScore(<span class="hljs-number">10</span>, <span class="hljs-string">"2"</span>) <span class="hljs-comment">// output : 102</span>
</code></pre>
<p>If someone passes the string or other thing, then it will throw an error in the production or runtime. Such as in the second example where the score becomes <code>102</code> it's a bug as shown in the image.</p>
<p>Now, How can we prevent that using typescript? We will look at the later in depth. You can define the type of a variable like this-</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> variableName: <span class="hljs-keyword">type</span> = value;
</code></pre>
<h2 id="heading-primitive-types">Primitive Types</h2>
<p>Primitive types in JavaScript are-</p>
<ul>
<li><p><code>string</code></p>
</li>
<li><p><code>boolean</code></p>
</li>
<li><p><code>number</code></p>
</li>
</ul>
<h3 id="heading-string">string</h3>
<p>String values are surrounded by single quotation marks or double quotation marks. They are used to store text data.</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> player: <span class="hljs-built_in">string</span> = <span class="hljs-string">"John"</span>;

<span class="hljs-comment">// ✅ CORRECT</span>
player = <span class="hljs-string">"anny"</span>;

<span class="hljs-comment">// ❌ ERROR: Type 'number' is not assignable to type 'string</span>
player = <span class="hljs-number">4</span>;
</code></pre>
<p>As you can see we assign the name (Anny) in line 3 and we assign the number in line 4 and it immediately throws an error. It's what typescript is. You don't need to run the TS to get the error as JS does.</p>
<h3 id="heading-boolean">boolean</h3>
<p>In boolean it could be either <code>true</code> or <code>false</code> otherwise, it will throw you an error as shown in the following code-</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> isLoggedIn: <span class="hljs-built_in">boolean</span> = <span class="hljs-literal">false</span>;

<span class="hljs-comment">// ✅ CORRECT</span>
isLoggedIn = <span class="hljs-literal">true</span>;

<span class="hljs-comment">// ❌ ERROR: Type 'number' is not assignable to type 'boolean'</span>
isLoggedIn = <span class="hljs-number">5</span>;

<span class="hljs-comment">// ❌ ERROR: Type 'string' is not assignable to type 'boolean'.</span>
isLoggedIn = <span class="hljs-string">"hello"</span>;
</code></pre>
<h3 id="heading-number">number</h3>
<p>JavaScript does not have a special runtime value for integers, so there’s no equivalent to <code>int</code> or <code>float</code> - everything is simply <code>number</code> that's why in <code>line 5</code> when we assign the <code>price</code> to <code>500.53</code> it doesn't give you an error because it's a number.</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> price: <span class="hljs-built_in">number</span> = <span class="hljs-number">200</span>;

<span class="hljs-comment">// 👇✅ CORRECT</span>
price = <span class="hljs-number">300</span>;
price = <span class="hljs-number">500.53</span>;

<span class="hljs-comment">// 👇❌ Error</span>
price = <span class="hljs-literal">false</span>;
price = <span class="hljs-string">"3000"</span>;
</code></pre>
<h3 id="heading-dont-use-any">Don't use `any`</h3>
<p>So the question occurred that why Shouldn't we use <code>any</code>? The answer is simply because when you use <code>any</code> then you disable all the type checking for that variable and anyone can assign any kind of value to the variable. For example:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// 👇 Wrong Practice (by default 'any')</span>
<span class="hljs-keyword">let</span> hello;

<span class="hljs-comment">// 👇 'hello' can take any type of value</span>
hello =  <span class="hljs-number">2</span>;
hello =  <span class="hljs-string">"world"</span>;
hello =  <span class="hljs-literal">true</span>;
</code></pre>
<p>On <code>line: 1</code> we have not defined the type of the variable <code>hello</code> so its defaults as <code>any</code> and you can assign whatever you want as shown in the above example.</p>
<p>Now Imagine the scenario where you are calling an API and getting the data in the <code>string</code> format, but someone changes it to the <code>boolean</code> or <code>number</code> then your whole app functionality will crash due to that mistake. And Typescript prevents you from doing that. For example:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> data; <span class="hljs-comment">// type by default is any</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getData</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-comment">//.........API Call</span>
    <span class="hljs-keyword">return</span>  <span class="hljs-string">"Message"</span>;
}

data = getData();         <span class="hljs-comment">// no issue because expected string</span>
</code></pre>
<p><strong>Another Example:</strong></p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> data;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getData</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-comment">//.........API Call</span>
    <span class="hljs-keyword">return</span> <span class="hljs-number">823</span>;
}

data = getData();         <span class="hljs-comment">// ISSUE: expected string but returns the number (won't throw error because type is `any`)</span>
</code></pre>
<p>Solution:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> data: <span class="hljs-built_in">string</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getData</span>(<span class="hljs-params"></span>)</span>{
    <span class="hljs-comment">//.........API Call</span>
    <span class="hljs-keyword">return</span>  <span class="hljs-string">"Message"</span>;
}

data = getData();
</code></pre>
<p>Now, if you pass something that is not a string then it will throw an error as shown below:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> data: <span class="hljs-built_in">string</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getData</span>(<span class="hljs-params"></span>)</span>{
  <span class="hljs-comment">//........API Call</span>
  <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
}

<span class="hljs-comment">// ❌ ERROR: Type 'boolean' is not assignable to type 'string'</span>
data = getData();
</code></pre>
<blockquote>
<p>You can use <code>any</code> whenever you don’t want a particular value to cause type-checking errors.</p>
<p>I'll cover <code>void</code>, <code>never</code> and others later in this series.</p>
</blockquote>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>In this article, I explained how you can use typescript to make sure that variable type is secure and no other value can manipulate that variable.</p>
<p>This is a series of Typescript that will help you to learn Typescript from the scratch. If you enjoyed this article, then don't forget to give ❤️ and Bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Twitter</td><td>GitHub</td><td>LinkedIn</td><td>Instagram</td><td>Website</td><td>Newsletter</td><td>Support</td></tr>
</thead>
<tbody>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
</tbody>
</table>
</div>]]></content:encoded></item><item><title><![CDATA[Typescript: Introduction]]></title><description><![CDATA[In this article, we are going learn about What is Typescript? What does it do? Installation process. After reading this article you will have a little bit idea of what is Typescript.

This is going to be a full series of typescript where you will lea...]]></description><link>https://hashnode.j471n.in/typescript-introduction</link><guid isPermaLink="true">https://hashnode.j471n.in/typescript-introduction</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Thu, 29 Dec 2022 19:08:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1672340843996/157072dc-4e84-45c5-a82c-12833f7f3816.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, we are going learn about What is Typescript? What does it do? Installation process. After reading this article you will have a little bit idea of what is Typescript.</p>
<blockquote>
<p>This is going to be a full series of typescript where you will learn from basic topics like string, boolean to more complex like Type Aliases, enums, Interface, generics, and etc.</p>
</blockquote>
<h2 id="heading-what-is-typescript">What is Typescript?</h2>
<p>TypeScript adds additional syntax to JavaScript to support a <strong>tighter integration with your editor</strong>. Catch errors early in your editor. TypeScript code converts to JavaScript, which <strong>runs anywhere JavaScript runs</strong>: In a browser, on Node.js or Deno, and in your apps. TypeScript understands JavaScript and uses <strong>type inference to give you great tooling</strong> without additional code.</p>
<ul>
<li><p>Typescript is a superset of JavaScript.</p>
</li>
<li><p>It doesn't add more features.</p>
</li>
<li><p>It allows you to code in a manner so that your code faces much less error in the run time or production.</p>
</li>
</ul>
<p><img src="https://imgur.com/udAkks3.png" alt="ts" /></p>
<p>Don't use typescript if your project is small. You need to use the superpower of the typescript if you are using it to make your code bug and error-free. It's all about <strong>the Type safety.</strong></p>
<pre><code class="lang-typescript">&gt; <span class="hljs-number">2</span> + <span class="hljs-string">"2"</span>
&gt; <span class="hljs-string">'22'</span> <span class="hljs-comment">// ans</span>

&gt; <span class="hljs-literal">null</span> + <span class="hljs-number">2</span>
&gt; <span class="hljs-number">2</span>

&gt; <span class="hljs-literal">undefined</span> + <span class="hljs-number">2</span>
&gt; <span class="hljs-literal">NaN</span>
</code></pre>
<p>This should not be done as it makes the issue bigger.</p>
<h2 id="heading-what-does-typescript-do">What does typescript do?</h2>
<p>It does static checking - whenever you are writing the code, then the code is constantly monitored by IDE to check if you are making any syntax error or something but not in JS. Whatever you write, it's ok.</p>
<p>But when you run the code in your environment, then it throws the error. It would be very helpful to get the idea of whether what you are doing is correct or not as you write the code.</p>
<p><strong>Analyze the code as we type. That's it.</strong></p>
<h3 id="heading-how-does-development-process-work">How does Development Process work?</h3>
<p>You write all your code in TS format and that code is converted to JavaScript. TS is a development tool and your project still run JS as the browser doesn't understand Typescript.</p>
<p>That's why when you install the TS package then you download it as a dev dependency.</p>
<p><a target="_blank" href="https://www.typescriptlang.org/play">TS Playground</a>: Here you can play with typescript and check how it is converted.</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> car = {
  <span class="hljs-keyword">module</span>: "xyz",
  color: "red",
};

// ❌ ERROR: Property 'price' does not exist on type '{ <span class="hljs-keyword">module</span>: string; color: string; }'.
car.price;
</code></pre>
<p>As the above code shows in the example we are trying to get the <code>price</code> which does not exist in the object and it shows the error before running the code.</p>
<pre><code class="lang-ts"><span class="hljs-keyword">let</span> num1 =  <span class="hljs-number">2</span>;
<span class="hljs-keyword">let</span> num2 =  <span class="hljs-string">"2"</span>

<span class="hljs-comment">// 👇 It works but shouldn't be done right?</span>
<span class="hljs-keyword">let</span> sum = num1 + num2; <span class="hljs-comment">// "22"</span>
</code></pre>
<p>The above code does not show any kind of error and when you run it will show you the result as <code>22</code> which we don't want. It is allowed, but we can bypass that by defining each variable as a type. We will look at the in later in this article.</p>
<h2 id="heading-install-typescript">Install Typescript</h2>
<p>There are two different installations for the project you can use-</p>
<h3 id="heading-global-installation">Global Installation</h3>
<p>In this, you install the Typescript as the global package. you can do that by simply running the following command in your terminal window-</p>
<pre><code class="lang-bash">npm install -g typescript
</code></pre>
<h3 id="heading-typescript-in-your-project">TypeScript in Your Project</h3>
<p>When you install typescript for your projects such as for React or Angular then their typescript config file is required what kind of setting you want or not. Use the following command to install the typescript to your project-</p>
<pre><code class="lang-bash">npm install typescript --save-dev
</code></pre>
<p>For more info <a target="_blank" href="https://www.typescriptlang.org/download">visit here</a>.</p>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>In this article, I explained what Typescript is and how it works and how you can install it in your system.</p>
<p>This is a series of Typescript that will help you to learn Typescript from the scratch. If you enjoyed this article, then don't forget to give ❤️ and Bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Twitter</td><td>GitHub</td><td>LinkedIn</td><td>Instagram</td><td>Website</td><td>Newsletter</td><td>Support</td></tr>
</thead>
<tbody>
<tr>
<td><a target="_blank" href="https://twitter.com/j471n_"><img src="https://cdn-icons-png.flaticon.com/32/4494/4494477.png" alt /></a></td><td><a target="_blank" href="https://github.com/j471n"><img src="https://cdn-icons-png.flaticon.com/32/2504/2504911.png" alt /></a></td><td><a target="_blank" href="https://www.linkedin.com/in/j471n/"><img src="https://cdn-icons-png.flaticon.com/32/3536/3536505.png" alt /></a></td><td><a target="_blank" href="https://instagram.com/j471n_"><img src="https://cdn-icons-png.flaticon.com/32/174/174855.png" alt /></a></td><td><a target="_blank" href="https://j471n.in"><img src="https://cdn-icons-png.flaticon.com/32/3178/3178285.png" alt /></a></td><td><a target="_blank" href="https://j471n.substack.com/"><img src="https://cdn-icons-png.flaticon.com/32/5822/5822078.png" alt /></a></td><td><a target="_blank" href="https://www.buymeacoffee.com/j471n"><img src="https://cdn-icons-png.flaticon.com/32/2935/2935413.png" alt /></a></td></tr>
</tbody>
</table>
</div>]]></content:encoded></item><item><title><![CDATA[How to use Google Analytics Data API]]></title><description><![CDATA[In this article, I am going to walk you through that how you Google Analytics Data API to fetch data from Google Analytics in the simplest way I can. After reading this article you'll be able to use this in your project with ease. So without further ...]]></description><link>https://hashnode.j471n.in/how-to-use-google-analytics-data-api</link><guid isPermaLink="true">https://hashnode.j471n.in/how-to-use-google-analytics-data-api</guid><category><![CDATA[Web Development]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[APIs]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Tue, 27 Dec 2022 09:17:40 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1672130591971/8404d7cb-3053-4ad6-bfd4-1345aefeb8ac.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I am going to walk you through that how you <a target="_blank" href="https://developers.google.com/analytics/devguides/reporting/data/v1">Google Analytics Data API</a> to fetch data from <a target="_blank" href="https://analytics.google.com/">Google Analytics</a> in the simplest way I can. After reading this article you'll be able to use this in your project with ease. So without further due, Let's jump into it.</p>
<p>In my <a target="_blank" href="https://j471n.in/">portfolio</a>, I have just implemented <a target="_blank" href="https://developers.google.com/analytics/devguides/reporting/data/v1">Google Analytics Data API</a> so that I can show how many people have visited this site in the last 7 days. As my Portfolio is already using Google Analytics to track user visits. I just need to use its API to fetch that data.</p>
<p>But first, look at how it's showing in <a target="_blank" href="https://j471n.in/">my portfolio</a>:</p>
<p><img src="https://i.imgur.com/gFNCTvQ.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-requirements">Requirements</h2>
<p>We need three values to fetch the data:</p>
<ul>
<li><p><code>GA_PROPERTY_ID</code></p>
</li>
<li><p><code>GA_CLIENT_EMAIL</code></p>
</li>
<li><p><code>GA_PRIVATE_KEY</code></p>
</li>
</ul>
<h3 id="heading-gapropertyid"><code>GA_PROPERTY_ID</code></h3>
<p>First, you need to get <code>GA_PROPERTY_ID</code> of the Google Analytics project from which you want to fetch the data.</p>
<p>To get this you need to follow these steps:</p>
<ul>
<li><p>Visit <a target="_blank" href="https://analytics.google.com/">Google Analytics</a>.</p>
</li>
<li><p>Select Admin.</p>
</li>
<li><p>Select the Property.</p>
</li>
<li><p>Select Property Settings.</p>
</li>
</ul>
<p>If the Property Settings shows a numeric <code>PROPERTY ID</code> such as "123...", this is the numeric Id of your Google Analytics 4 property.</p>
<p><img src="https://i.imgur.com/scjFbin.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-gaclientemail-and-gaprivatekey"><code>GA_CLIENT_EMAIL</code> and <code>GA_PRIVATE_KEY</code></h3>
<p>To get <code>GA_CLIENT_EMAIL</code> and <code>GA_PRIVATE_KEY</code> you need to visit Google Analytics Data API's <a target="_blank" href="https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries">documentation</a> and then click on <strong>Enable the Google Analytics Data API v1</strong> button as shown in the image below:</p>
<p><img src="https://i.imgur.com/WrN2YwC.png" alt class="image--center mx-auto" /></p>
<p>And then you will be prompted to enter the name of the project. After entering the name click on the <strong>Next</strong> button</p>
<p><img src="https://i.imgur.com/2BwwX84.png" alt class="image--center mx-auto" /></p>
<p>Then you will be prompted to download the credential file as JSON.</p>
<p><img src="https://i.imgur.com/TU6qYrV.png" alt class="image--center mx-auto" /></p>
<p>After downloading that file. You will find <code>private_key</code> and <code>client_email</code> properties in that JSON file. Save these two in your <code>.env.local</code>.</p>
<p>Now you have all the necessary information or keys.</p>
<h2 id="heading-installing-dependency">Installing Dependency</h2>
<p>To fetch the data you need to install a <a target="_blank" href="https://www.npmjs.com/package/@google-analytics/data">@google-analytics/data</a> package. You can do that by simply running the following command in the terminal.</p>
<pre><code class="lang-bash">yarn add @google-analytics/data
<span class="hljs-comment"># or </span>
npm i @google-analytics/data
<span class="hljs-comment"># or</span>
pnpm i @google-analytics/data
</code></pre>
<h2 id="heading-using-google-analytics-data-api-in-project">Using Google Analytics Data API in Project</h2>
<p>As I am using <a target="_blank" href="https://nextjs.org/">Next.js</a> for my portfolio so I will use <a target="_blank" href="https://nextjs.org/docs/api-routes/introduction">Next.js API Routes</a>. You can do the same thing with different frameworks.</p>
<p>I will create an API route <code>pages/api/ga.ts</code>:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> { NextApiRequest, NextApiResponse } <span class="hljs-keyword">from</span> <span class="hljs-string">"next"</span>;
<span class="hljs-keyword">import</span> { BetaAnalyticsDataClient } <span class="hljs-keyword">from</span> <span class="hljs-string">"@google-analytics/data"</span>;

<span class="hljs-comment">// 👇 Setting PropertyId</span>
<span class="hljs-keyword">const</span> propertyId = process.env.GA_PROPERTY_ID;

<span class="hljs-keyword">const</span> analyticsDataClient = <span class="hljs-keyword">new</span> BetaAnalyticsDataClient({
  credentials: {
    client_email: process.env.GA_CLIENT_EMAIL,
    private_key: process.env.GA_PRIVATE_KEY?.replace(<span class="hljs-regexp">/\n/gm</span>, <span class="hljs-string">"\n"</span>), <span class="hljs-comment">// replacing is necessary</span>
  },
});

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">handler</span>(<span class="hljs-params">
  _req: NextApiRequest,
  res: NextApiResponse
</span>) </span>{
  <span class="hljs-comment">// 👇 Running a simple report</span>
  <span class="hljs-keyword">const</span> [response] = <span class="hljs-keyword">await</span> analyticsDataClient.runReport({
    property: <span class="hljs-string">`properties/<span class="hljs-subst">${propertyId}</span>`</span>,
    dateRanges: [
      {
        startDate: <span class="hljs-string">`7daysAgo`</span>, <span class="hljs-comment">//👈  e.g. "7daysAgo" or "30daysAgo"</span>
        endDate: <span class="hljs-string">"today"</span>,
      },
    ],
    dimensions: [
      {
        name: <span class="hljs-string">"year"</span>, <span class="hljs-comment">// I wanted the data be year wised</span>
      },
    ],
    metrics: [
      {
        name: <span class="hljs-string">"activeUsers"</span>, <span class="hljs-comment">// it returs the active users</span>
      },
    ],
  });

  <span class="hljs-comment">// Returning the respose.</span>
  <span class="hljs-keyword">return</span> res.status(<span class="hljs-number">200</span>).json({
    response,
  });
}
</code></pre>
<p>This is all you need to fetch the data. and It will return the response. My portfolio code can be found on <a target="_blank" href="https://github.com/j471n/j471n.in/blob/main/pages/api/ga.ts">GitHub</a> you can check out How I used it.</p>
<p>You can play with <a target="_blank" href="https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema">Dimensions and Metrics</a> to get your desired data.</p>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>In this article, I have explained how you can use the Google Analytics Data API to fetch data from Google Analytics. After reading this article, you should now be able to easily implement this API on your projects.</p>
<p>If you enjoyed this article, then don't forget to give ❤️ and Bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Twitter</td><td>GitHub</td><td>LinkedIn</td><td>Instagram</td><td>Website</td><td>Newsletter</td><td>Support</td></tr>
</thead>
<tbody>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td>[]</td></tr>
</tbody>
</table>
</div>]]></content:encoded></item><item><title><![CDATA[Chrome Extensions of the Month - December 2022]]></title><description><![CDATA[In this article, I will suggest to you some of the best extensions you need to install for better productivity that can come in very handy. So without further due, let's get into it.
1. NOVA (new tab)
Nova is one of the best new tab extensions for Ch...]]></description><link>https://hashnode.j471n.in/chrome-extensions-of-the-month-december-2022</link><guid isPermaLink="true">https://hashnode.j471n.in/chrome-extensions-of-the-month-december-2022</guid><category><![CDATA[Chrome Extensions of the Month]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[chrome extension]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Sun, 25 Dec 2022 09:49:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1671955534563/b60920fd-9215-4bf5-a11f-02699b09d341.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I will suggest to you some of the best extensions you need to install for better productivity that can come in very handy. So without further due, let's get into it.</p>
<h2 id="heading-1-nova-new-tab">1. NOVA (new tab)</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/nova-new-tab-with-theme/cmfhopmhaagcfnjflfppceclmkenjkpc?hl=en">Nova</a> is one of the best new tab extensions for Chrome with a minimalistic, light and dark theme, and a fully customizable New Tab page with a built-in to-do list, clock, calendar, Pomodoro, notes, RSS reader, weather and news.</p>
<p><img src="https://lh3.googleusercontent.com/N4k6E3gMxvNjoD7sVc-Ol_xom1pu9EskMQkqjEaU0jxCc2Y61e_A4LHAY3Scb0C9YTxYGwMJTLLPkIm9ZPFGXQ413A=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-2-deepl-translate">2. DeepL Translate</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/deepl-translate-reading-w/cofdbpoegempjloogbagkncekinflcnj?hl=en">DeepL Translate</a> lets you translate from one language to another. Sounds similar? Yes. It sounds like Google translate. The main difference is that it has tons of features such as-</p>
<ul>
<li><p>Translate while you are writing.</p>
</li>
<li><p>Translate while you are reading.</p>
</li>
<li><p>Full-page translation (For PRO users).</p>
</li>
<li><p>It supports 26 languages.</p>
</li>
<li><p>If you visit their <a target="_blank" href="https://www.deepl.com/translator/files">website</a> then you can even translate the whole document (.pdf, .docx, .ppt)</p>
</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/dRjn1llyJu3mnxLmswS_45_vPUP294BM26ntwWjlV7FRDg6U0imp_H7Da3FLRYyeUQQIww2ZGMvL4RGyO0Lwc_Z5ng=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-3-stayfree">3. StayFree</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/stayfree-website-blocker/elfaihghhjjoknimpccccmkioofjjfkf">StayFree</a> - Web Analytics &amp; Screen Time Tracker is analytics, self-control, productivity, and web addiction controller extension. StayFree provides analytics to help you understand how you are using the internet (daily website usage statistics), and factors leading to distractions (such as advertisements you have seen), and focus your time by restricting the usage of distracting websites.</p>
<p><img src="https://lh3.googleusercontent.com/zh-YyATWuiMVr_DnbzsTMnMxADm2KKhej9BPrqOjWjZxl6m4FbWFUVdiXjCfzxg2SyZNxkyI6Ag3hbQsO8M0w8vi8A=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-4-listly">4. Listly</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/listly-free-data-scraper/ihljmnfgkkmoikgkdkjejbkpdpbmcgeh/related">Listly</a> converts any website to Excel in just a few clicks. Speed up your data collection and put your time and effort into what really matters to you. You can also Schedule a daily extraction.</p>
<p><img src="https://lh3.googleusercontent.com/Q21Y01w6-20bwGnC-dhXTuDm0if_vaiyjbVh1q4g1rRXNRx-9OzlYGaGT52tiEX36JCIDNkf6AR6iLIp80ujswoasso=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<p><img src="https://lh3.googleusercontent.com/JWOsf3-HJmbDqTWySRFqkik_5z5CyzJGfjA3uuv2yCZLbJLB2n5NWC13kh57TKCRp2hfQz_MD0NBMlavUnqi-TmN0Jo=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-5-minimal-theme-for-twitter">5. Minimal Theme for Twitter</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/minimal-theme-for-twitter/pobhoodpcipjmedfenaigbeloiidbflp">Minimal Theme for Twitter</a> refines and cleans up the Twitter interface, and adds useful features and customizations:</p>
<ul>
<li><p>Remove the distracting trends sidebar</p>
</li>
<li><p>Customize your Timeline width</p>
</li>
<li><p>Remove Timeline and Tweet borders for a more minimalistic look</p>
</li>
<li><p>Customize the left navigation</p>
</li>
<li><p>Hide vanity counts under tweets</p>
</li>
<li><p>Remove promoted posts</p>
</li>
<li><p>Remove "Who to Follow" and other suggestions</p>
</li>
<li><p>Hide the Search Bar</p>
</li>
<li><p>Hide the Tweet button</p>
</li>
<li><p>Hide View Counts</p>
</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/DcJtUQTRtVNJ_fjfLehL9L2QYO9Ny2jTdeir8T9OfPX8gECS4h5aA_onLsA75-grngfwRN7VTcWWEVtWjbFpSDfdHQQ=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<p><img src="https://lh3.googleusercontent.com/1I--BWRsXOeaoXM9F313pPJSzlyQZVXx6FxhjlDMZHXgpXkVnPzn5SByIUQ6h8RWwcFDXLz5bZPjDmbKUAyjlRYPK1s=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-6-robots-exclusion-checker">6. Robots Exclusion Checker</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/robots-exclusion-checker/lnadekhdikcpjfnlhnbingbkhkfkddkl">Robots Exclusion Checker</a> is designed to visually indicate whether any robots exclusions are preventing your page from being crawled or indexed by Search Engines</p>
<p><strong>The extension reports on 5 elements:</strong></p>
<ul>
<li><p>Robots.txt</p>
</li>
<li><p>Meta Robots tag</p>
</li>
<li><p>X-robots-tag</p>
</li>
<li><p>Rel=Canonical</p>
</li>
<li><p>UGC, Sponsored and Nofollow attribute values</p>
</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/56vQxRGPdh8ITUV2pjfowShuPqyMiVh_VZNgQI7jjP28KXksrZWMmTno3fxdPdLmW4VVLdcJe_b9FKZs2iHJQJHX4w=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-7-motion-devtools">7. Motion DevTools</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/motion-devtools/mnbliiaiiflhmnndmoidhddombbmgcdk">Motion DevTools</a> is a browser extension to inspect, edit and export animations made with CSS and Motion One. I highly recommend you use this extension if you work with animations.</p>
<p><img src="https://lh3.googleusercontent.com/v1xDwsqk7daYdyuMiWDWXb5U8Y14WjdaH_3NY_0pF0PPdDl1hAcSwqeThLYTX3-83YX59IWnBxDQibbptZcxzB9S6w=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-8-chroma">8. Chroma</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/chroma-ultimate-eyedroppe/pkgejkfioihnchalojepdkefnpejomgn">Chroma</a> is a free, user-friendly color tool that allows you to easily sample colors from your screen while browsing the internet. It is highly intuitive and simple to use.</p>
<p><img src="https://lh3.googleusercontent.com/gUo_414NWXSYgLxXTqa2qUW-Mpys4wtGZwW9Gdx_lR25gNZAfMZLQs73jtIWhp1xsOSlzcTD1z5DM8odvfuR9B_bDt0=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-9-monaco-markdown-editor-for-github">9. Monaco Markdown Editor For GitHub</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/monaco-markdown-editor-fo/mmpbdjdnmhgkpligeniippcgfmkgkpnf?hl=en">Monaco Markdown Editor For GitHub</a> is an open-source extension that replaces all GitHub text areas for authoring markdowns with a monaco editor.</p>
<p><strong>Features:</strong></p>
<ul>
<li><p>Syntax Highlighting of Markdown and Code Snippets</p>
</li>
<li><p>Tab to indent and Shift+Tab to outdent entire selections</p>
</li>
<li><p>Multi-Cursor Editing</p>
</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/WhtCPBpnXxFfSIOBKSWPePYuPLqnVITYJ7l0a_wCZf-6j2s0HQHN_lpM5EL-HVzJVvqhqLVOLk67VSQl5JhIGoyJ8w=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h2 id="heading-10-dopely-colors">10. Dopely Colors</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/dopely-colors/likjnedfkpkabglldlnelmochinjpbjm?hl=en">Dopely Colors</a> is a package of advanced color tools that we believed to be essential for every creator.</p>
<p><strong>Features:</strong></p>
<ul>
<li><p>Color Picker</p>
</li>
<li><p>Color Gradient Generator</p>
</li>
<li><p>Color Tab</p>
</li>
<li><p>Color Contrast Checker</p>
</li>
<li><p>Color Blindness Simulator</p>
</li>
<li><p>Color Toner</p>
</li>
<li><p>Save &amp; Export your colors</p>
</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/KY37hcI_qnH4M1ukGF2sw6dDJOEhZgYLScy71XoZ8DDsnz7yxFSEnfWJxs6HtGTXCpwcmLgFQpFTwcIqNxHH7H-P=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<p><img src="https://lh3.googleusercontent.com/XS9LCeYkrQ8jy_D_P7cjeawB9_m44Cl1M-uqk2-caQVYaOmt6jkkVyxNruVkF8EM0Bfsd-_f5CKHa8bAwuqd-hK3iVo=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<p><img src="https://lh3.googleusercontent.com/VUFq_7ZmnyomOVKyc4w7wYLX7i1wBCcOShErhiwptsLXbT_9uI6zhxTAPvrwcPWUUl5V5Ap9vvj_KGcygWfh1mEpnw=w640-h400-e365-rj-sc0x00ffffff" alt /></p>
<h3 id="heading-merry-christmas">Merry Christmas 🎄</h3>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/j471n_/status/1606936674457776128">https://twitter.com/j471n_/status/1606936674457776128</a></div>
<p> </p>
<h2 id="heading-wrapping-up"><strong>Wrapping up</strong></h2>
<p>These were some extensions for this month (December 2022). You might have heard some before, but if you like anyone then don't forget to press ❤️. I have personally used all the above extensions and from my experience, every extension is worth installing.</p>
]]></content:encoded></item><item><title><![CDATA[Make Your Video Player Float Using PiP API]]></title><description><![CDATA[In this article, I am going to make your video player float by using Picture-in-Picture (PiP) JavaScript Web API. This could be an important feature you can add to your website. If your website is showing a demo or has many videos.
Most of you might ...]]></description><link>https://hashnode.j471n.in/make-your-video-player-float-using-pip-api</link><guid isPermaLink="true">https://hashnode.j471n.in/make-your-video-player-float-using-pip-api</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[CSS]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Mon, 19 Dec 2022 06:51:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1670937665979/QuRE4IMjT.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I am going to make your video player float by using Picture-in-Picture (PiP) JavaScript Web API. This could be an important feature you can add to your website. If your website is showing a demo or has many videos.</p>
<p>Most of you might have heard of this <a target="_blank" href="https://chrome.google.com/webstore/detail/picture-in-picture-extens/hkgfoiooedgoejojocmhlaklaeopbecg?hl=en">Picture-in-Picture Extension</a>. It allows you to watch videos in a floating window (always on top of other windows). It works mostly on every site.</p>
<p>But we will create our custom Button that makes this feature available for our website by default. So our users won't need this extension. Let's dive into it.</p>
<h2 id="heading-what-is-picture-in-picture-api">What is Picture-in-Picture API?</h2>
<p>The <strong>Picture-in-Picture API allows</strong> websites to create a floating video window always on top of other windows so that users may continue consuming media while they interact with other content sites or applications on their devices. Simple, Right?</p>
<h2 id="heading-lets-look-at-the-demo">Let's look at the demo</h2>
<p>The following gif shows the demo of how that works:</p>
<p><img src="https://i.imgur.com/7HB3aTR.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-lets-build-it">Let's build it</h2>
<p>First, we need a structure means HTML so for that I have simply used two things <code>video</code> and <code>button</code>.</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"video-container"</span>&gt;</span>
   <span class="hljs-tag">&lt;<span class="hljs-name">video</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"videoElement"</span> <span class="hljs-attr">controls</span> <span class="hljs-attr">loop</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://imgur.com/yIVEIR9.mp4"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">video</span>&gt;</span>
   <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"toggleButton"</span>&gt;</span>Enable Floating Video<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<p>CSS for this can be found at the end of the article in the Codepen. Now the main thing is <strong>JavaScript.</strong> Let's add that.</p>
<p>First getting the <code>video</code> and <code>button</code>:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> video = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"videoElement"</span>);
<span class="hljs-keyword">const</span> toggleBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"toggleButton"</span>);
</code></pre>
<p>After that, we need to verify if your browser supports that or not. You can do like the following:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// 👇Checking that if it is working or not</span>
<span class="hljs-keyword">if</span> (<span class="hljs-string">"pictureInPictureEnabled"</span> <span class="hljs-keyword">in</span> <span class="hljs-built_in">document</span>) {
    <span class="hljs-comment">/// .... other code</span>
}
</code></pre>
<p>Now we need to add an event listener on the <code>toggleBtn</code> and when it is clicked then we will run a function called <code>togglePiPMode</code></p>
<pre><code class="lang-javascript"> <span class="hljs-comment">// 👇Checking that if it is working or not</span>
<span class="hljs-keyword">if</span> (<span class="hljs-string">"pictureInPictureEnabled"</span> <span class="hljs-keyword">in</span> <span class="hljs-built_in">document</span>) {
  <span class="hljs-comment">// 👇 Running 'togglePiPMode' function when user click the button</span>
  toggleBtn.addEventListener(<span class="hljs-string">"click"</span>, togglePiPMode);
}
</code></pre>
<p>Now it's time to create <code>togglePiPMode</code> function. First, I check if the user is already in PiP mode or not. If he is not the only then request for Picture-in-Picture mode. otherwise simply just exit from PiP. I have wrapped the code in <code>try...catch</code> block to make sure if something goes wrong then it will <code>console</code> the error.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">togglePiPMode</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">try</span> {
    <span class="hljs-comment">// 👇 Checking that if user should not be in PiP mode</span>
    <span class="hljs-keyword">if</span> (video !== <span class="hljs-built_in">document</span>.pictureInPictureElement) {
      video.requestPictureInPicture();
    } <span class="hljs-keyword">else</span> {
      <span class="hljs-built_in">document</span>.exitPictureInPicture(); <span class="hljs-comment">// 👈 If already in PIP Mode then exit</span>
    }
  } <span class="hljs-keyword">catch</span> (error) {
    <span class="hljs-built_in">console</span>.log(error); <span class="hljs-comment">// Console any error if any</span>
  }
}
</code></pre>
<p>Now Picture-in-Picture mode will work flawlessly.</p>
<h3 id="heading-full-javascript-code">Full JavaScript Code</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> video = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"videoElement"</span>);
<span class="hljs-keyword">const</span> toggleBtn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"toggleButton"</span>);

<span class="hljs-comment">// 👇Checking that if it is working or not</span>
<span class="hljs-keyword">if</span> (<span class="hljs-string">"pictureInPictureEnabled"</span> <span class="hljs-keyword">in</span> <span class="hljs-built_in">document</span>) {
  <span class="hljs-comment">// 👇 Running 'togglePiPMode' function when user click the button</span>
  toggleBtn.addEventListener(<span class="hljs-string">"click"</span>, togglePiPMode);

  <span class="hljs-comment">// 👇 event trigger when you enter in PiP mode</span>
  video.addEventListener(<span class="hljs-string">"enterpictureinpicture"</span>, <span class="hljs-function">() =&gt;</span> {
    toggleBtn.textContent = <span class="hljs-string">"Exit PiP Mode"</span>;
  });

  <span class="hljs-comment">// 👇 event trigger when you leave the PiP mode</span>
  video.addEventListener(<span class="hljs-string">"leavepictureinpicture"</span>, <span class="hljs-function">() =&gt;</span> {
    toggleBtn.textContent = <span class="hljs-string">"Enter PiP Mode"</span>;
  });
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">togglePiPMode</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">try</span> {
    <span class="hljs-comment">// 👇 Checking that if user should not be in PiP mode</span>
    <span class="hljs-keyword">if</span> (video !== <span class="hljs-built_in">document</span>.pictureInPictureElement) {
      video.requestPictureInPicture();
    } <span class="hljs-keyword">else</span> {
      <span class="hljs-built_in">document</span>.exitPictureInPicture(); <span class="hljs-comment">// 👈 If already in PIP Mode then exit</span>
    }
  } <span class="hljs-keyword">catch</span> (error) {
    <span class="hljs-built_in">console</span>.log(error); <span class="hljs-comment">// Console any error if any</span>
  }
}
</code></pre>
<h2 id="heading-lets-understand-events-in-pip">Let's understand events in PiP</h2>
<p><em>The Picture-in-Picture API defines three events, which can be used to detect when picture-in-picture mode is toggled and when the floating video window is resized.</em></p>
<ul>
<li><p><code>enterpictureinpicture</code>: Sent to a <code>HTMLVideoElement</code> when it enters picture-in-picture mode.</p>
</li>
<li><p><code>leavepictureinpicture</code> : Sent to a <code>HTMLVideoElement</code> when it leaves picture-in-picture mode.</p>
</li>
<li><p><code>resize</code> : Sent to a <code>PictureInPictureWindow</code> when it changes size.</p>
</li>
</ul>
<p>Let's use <code>enterpictureinpicture</code> &amp; <code>leavepictureinpicture</code> in our little project. I'll be changing the Button Text as these events are fired. Let's take a look at the code:</p>
<pre><code class="lang-javascript"> <span class="hljs-comment">// 👇 event trigger when you enter in PiP mode</span>
  video.addEventListener(<span class="hljs-string">"enterpictureinpicture"</span>, <span class="hljs-function">() =&gt;</span> {
    toggleBtn.textContent = <span class="hljs-string">"Exit PiP Mode"</span>;
  });

  <span class="hljs-comment">// 👇 event trigger when you leave the PiP mode</span>
  video.addEventListener(<span class="hljs-string">"leavepictureinpicture"</span>, <span class="hljs-function">() =&gt;</span> {
    toggleBtn.textContent = <span class="hljs-string">"Enter PiP Mode"</span>;
  });
</code></pre>
<p>Now, Let's take a look at the <code>resize</code> event. When we run <code>requestPictureInPicture</code> then it returns a promise and we add <code>resize</code> event on <code>pictureInPictureWindow</code> when it fires then we call a function <code>windowDimensions</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// 👇 This will print the dimensions of the window</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">windowDimensions</span>(<span class="hljs-params">evt</span>) </span>{
  <span class="hljs-keyword">const</span> pipWindow = evt.target;
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Floating window Dimensions : <span class="hljs-subst">${pipWindow.width}</span>x<span class="hljs-subst">${pipWindow.height}</span>px`</span>);
}

<span class="hljs-comment">// 👇 resize event on pip window</span>
video.requestPictureInPicture().then(<span class="hljs-function">(<span class="hljs-params">pictureInPictureWindow</span>) =&gt;</span> {
  pictureInPictureWindow.onresize = windowDimensions;
});
</code></pre>
<p>From <code>PictureInPictureWindow</code> interface we can get the <code>width</code> and <code>height</code> and <code>resize event</code> of the floating video window.</p>
<h2 id="heading-codepen">Codepen</h2>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://codepen.io/j471n/pen/qBKzbbo">https://codepen.io/j471n/pen/qBKzbbo</a></div>
<p> </p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>In this article, I have explained how you can make a floating video player by using Picture-in-Picture (PiP) JavaScript Web API. Now, you can try to add this functionality to your website.</p>
<p>If you enjoyed this article, then don't forget to give ❤️ and Bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Twitter</td><td>GitHub</td><td>LinkedIn</td><td>Instagram</td><td>Website</td><td>Newsletter</td><td>Support</td></tr>
</thead>
<tbody>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
</tbody>
</table>
</div>]]></content:encoded></item><item><title><![CDATA[Revue Getting Shut down]]></title><description><![CDATA[Revue makes it easy for journalists, writers and creators to send a newsletter — and make money with it.
It was built for people who publish, whether it’s a one-person operation or a whole organization. We know how much work goes into creating great ...]]></description><link>https://hashnode.j471n.in/revue-getting-shut-down</link><guid isPermaLink="true">https://hashnode.j471n.in/revue-getting-shut-down</guid><category><![CDATA[Twitter]]></category><category><![CDATA[news]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[shutdown]]></category><category><![CDATA[newsletter]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Wed, 14 Dec 2022 17:32:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1671038964523/XW7OBksV8.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Revue makes it easy for journalists, writers and creators to send a newsletter — and <a target="_blank" href="http://help.getrevue.co/en/collections/2637257-paid-newsletters">make money with it</a>.</p>
<p>It was built for people who publish, whether it’s a one-person operation or a whole organization. We know how much work goes into creating great newsletters, and we can help yours reach a loyal audience and grow indefinitely.</p>
<p>But now it's getting shut down for some reason from January 12, 2023, you won't be able to access your Revue account. All the data will be deleted.</p>
<p>We don't know why it's getting shut down as Revue is a product by <a target="_blank" href="https://twitter.com">Twitter</a>. And since Elon Musk completed his $44 billion takeover of Twitter. I guess <strong>It's all part of his plan.</strong></p>
<p>You can export all of your data including your subscriber list, past newsletter issues, and analytics by following the instructions <a target="_blank" href="http://www.getrevue.co/app/offboard">here</a> after logging into your account.</p>
<p>If you are using Revue like me then we have to migrate to some other places. You can share your thoughts on this in the comment section. I'll see you in the next one.</p>
]]></content:encoded></item><item><title><![CDATA[How to Test GraphQL API]]></title><description><![CDATA[You've just created a GraphQL API and are ready to test it. But where do you start? How do you know if it's working correctly?
Testing your API is essential in ensuring that it functions correctly and meets your users' needs. But it can be tricky to ...]]></description><link>https://hashnode.j471n.in/how-to-test-graphql-api</link><guid isPermaLink="true">https://hashnode.j471n.in/how-to-test-graphql-api</guid><category><![CDATA[GraphQL]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Mon, 12 Dec 2022 04:48:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1670820283654/HzQ1_YBXn.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You've just created a GraphQL API and are ready to test it. But where do you start? How do you know if it's working correctly?</p>
<p>Testing your API is essential in ensuring that it functions correctly and meets your users' needs. But it can be tricky to know where to start and what to test.</p>
<p>In this article, we'll walk you through the process of testing your GraphQL API. We'll cover everything from initial testing to load testing and performance monitoring. By the end of this article, you'll know exactly how to test your API and be one step closer to launching it into the world.</p>
<h3 id="heading-what-is-graphql">What Is GraphQL?</h3>
<p>If you don't know, Graph QL is a query language for APIs that Facebook developed. It allows you to request data from an API in a declarative way, making it easier to work with complex data structures.</p>
<p>A server-side runtime for executing queries using a type system you define for your data is provided by GraphQL, which is a query language for your API. GraphQL is supported by your current code and data rather than being dependent on any one database or storage engine.</p>
<p>Kinds and fields on those types are defined, and then functions are provided for each field on each type to establish a GraphQL service. </p>
<p>GraphQL is gaining popularity, and many developers are looking to learn how to use it. In this guide, we'll go over some of the basics of Graph QL and how you can test your Graph QL API.</p>
<h3 id="heading-why-use-it">Why Use it?</h3>
<p>So, why use Graph QL?</p>
<p>There are a few reasons:</p>
<ul>
<li><p><strong>Simplicity</strong>: Graph QL is designed to make it easy to get the data you need in one request. This means less code overall, which is always a good thing.</p>
</li>
<li><p><strong>Efficiency</strong>: With Graph QL, you can specify the data you need in your request. This means that the server doesn't have to send extra data you don't need, making your requests more efficient.</p>
</li>
<li><p><strong>Flexibility</strong>: Graph QL is flexible enough to be used for any data, from simple data like strings and numbers to more complex data like images and files.</p>
</li>
</ul>
<p>Overall, Graph QL is a powerful tool that can make your life easier as a developer. So if you're working with APIs, definitely give it a try!</p>
<h3 id="heading-what-is-worth-considering">What is worth considering?</h3>
<p>Now when you know what Graph QL is and why it's essential, it's time to learn what to pay attention for when testing a Graph QL API. There are a few different things you'll want to keep in mind:</p>
<ul>
<li><p>The data types of the fields: Are they the correct data type?</p>
</li>
<li><p>The structure of the data: Is the data in the correct order?</p>
</li>
<li><p>The relationships between types: Are the correct relationships being returned?</p>
</li>
<li><p>The permissions: Is the data being returned only to those who have permission to see it?</p>
</li>
</ul>
<p>To ensure that the queries, adjustments, and schemas made for an application function as intended on the front end, GraphQL APIs are used.</p>
<p>These are just a few things you'll want to remember when testing a Graph QL API. By keeping these factors in mind, you can be sure that your API is functioning correctly and that your data is safe.</p>
<h2 id="heading-how-to-test-graphql-api">How to test GraphQL API?</h2>
<p>Now that we've gone over some of the basics of testing GraphQL APIs let's talk about some of the tools you can use to make your life a little easier.</p>
<p>You can do a few different things on the pc you want to test your Graph QL API.</p>
<p>First, you can use a third-party testing tool like GraphiQL. This is an excellent option to test your API without writing any code.</p>
<p>Another option is to use a tool like Postman. With this tool, you can send HTTP requests to your API and get back responses. This is an excellent option if you want to test specific functionality in your API.</p>
<p>Also you can use a tool like SoapUI. This tool allows you to test both SOAP and REST APIs. This is an excellent option if you want to test your API with both requests.</p>
<p>The most well-liked GraphQL functional testing tools for JavaScript developers. You may quickly test assertions to confirm API replies as part of an automated test suite by integrating with a tool like Mocha.</p>
<p>There are a few different options out there for PC users, like <strong>GraphQL CLI</strong>. It's a command line interface that lets you automatically generate tests for your schema, and it's straightforward to use.</p>
<p>Another great option is the <strong>Apollo Server</strong> playground. This is a graphical interface that lets you interact with your API in a user-friendly way.</p>
<p>These tools are great for testing GraphQL APIs, so it comes down to personal preference. <strong>They are used on PC, but there is a twist next to make your testing and work efficiency fast.</strong></p>
<h2 id="heading-api-tester-mobile-app-all-problems-one-solution">API Tester Mobile App all problems one solution</h2>
<p>In the struggle to test your APIs using your phone, API Tester mobile app enters the picture. It will give you a hassle-free and mobile-optimized experience for your ongoing job.</p>
<p>It has all the tools you need to use them. You may run any test using its advanced editor and API Testing environment.</p>
<p>Your laptop is no longer necessary for daily use. Debugging and testing your API can be done quickly and anywhere. It supports the Graph Ql testing environment and all effective methods, gets, and posts.</p>
<p>You can download API Tester mobile app to your iPhone, iPad, or Android device. Go to <a target="_blank" href="http://apitester.org">apitester.org</a> or search on Play store/App Store, API Tester on the first you can see and download it.</p>
<p>After the development of API, do you want to test your GraphQL queries on a mobile app? You can see below how to use API Tester to do just that.</p>
<p><strong>Let's walk through how to use API Tester to test your GraphQL queries on a mobile app.</strong></p>
<h2 id="heading-lets-use-the-api-tester-app">Let's use the API tester app</h2>
<p>I'm going to use the GitHub API to demonstrate how to work with API tester app. It provides us with real-time data.</p>
<p>Click on “create new request” or + button in the top right corner to start a Graph QL request.</p>
<p>You can see it in the attached screenshots.</p>
<p><img src="https://i.imgur.com/3p8Qh7M.png" alt="image1" /></p>
<p>You can easily see the Graph QL option in the new tab under Other features. Clicking on it will take you to further options.</p>
<p><img src="https://imgur.com/4RUAUE3.png" alt="image1" /></p>
<p>On the next screen you can see a GraphQL untitled request.</p>
<p>The first tab shows the Request Name. You can rename it (which is a good practice so you don't get confused when there are a lot of requests).</p>
<p>Also, you need to provide the API URL and paste it into the section starting with HTTPS.</p>
<p>You can see multiple options for Graph QL below, like Body, Variables, Headers, Docs and Settings.</p>
<p>I'm going to use the GitHub API, so I’ll put <code>api.github.com/graphql</code> in URL section.</p>
<p><img src="https://imgur.com/dX4DkYz.png" alt="image3" /></p>
<p>When you execute this now, you’ll see that this endpoint requires you to be authenticated, so you need to provide the authentication information and go to the request. </p>
<p><img src="https://imgur.com/WzgInIi.png" alt="img4" /></p>
<p>In Headers sections you can see the OAuth option, so you need to provide the access token here. You can generate it from GitHub. I will use my token for an explanation and provide it in the corresponding field.</p>
<p><img src="https://imgur.com/ZLP9NWw.png" alt="img5" /></p>
<h2 id="heading-how-to-generate-github-api-token-access-key">How to generate GitHub API token access key.</h2>
<p>To generate a key first go to <a target="_blank" href="https://github.com">github.com</a> and login in to your account using your credentials and then <strong>Click on your profile avatar</strong> in the upper right corner and select <strong>Settings</strong>.</p>
<p><img src="https://imgur.com/UGkjSAC.png" alt /></p>
<p>At the bottom end you can see another option known as <strong>Developer settings</strong>. Click on that option and move further next.</p>
<p><img src="https://imgur.com/YZvndCL.png" alt /></p>
<p>Three options are visible here. Select <strong>personal access token</strong> option, and click on <strong>generate new token (classic)</strong>.</p>
<p><img src="https://imgur.com/sdAmRrB.png" alt /></p>
<p>In the note section write the name of the token to remember it. Next select the <strong>expiry date</strong> of the token.</p>
<p>In the further options select <strong>scope of tokens</strong> for OAuth access purpose, what you want to permit access or don't want to permit access.</p>
<p>After completing these settings click on the button at bottom <strong>Generate token</strong>.</p>
<p><img src="https://imgur.com/F1us5tO.png" alt /></p>
<p>Congratulations, our token is generated! We can use it for your API testing in the app for Graph QL testing purpose.</p>
<p><img src="https://imgur.com/nQQ98PP.png" alt /></p>
<h2 id="heading-lets-continue-creating-the-request">Let's continue creating the request</h2>
<p>I will paste a created token in the OAuth section as I pointed above.</p>
<p>Now we have to go to the Body section and specify a query to get your specific type of data. For example, let’s get the id information of a GitHub account. So, the corresponding Query using the GitHub login is written in the body tab, as you can see in the screenshot below.</p>
<p><img src="https://imgur.com/iBHhm1w.png" alt /></p>
<p>If you execute this now, you will see that you get the login and id of the GitHub profile.</p>
<p><img src="https://imgur.com/I8tb7kW.png" alt /></p>
<p>Also, if you want to get an URL, bio or whatever available information you want, you should provide it in the body section as a Query. </p>
<p>In the Docs section, you can see the queries and mutations. They will help you how to execute an explicit request.</p>
<p><img src="https://imgur.com/LPitoYZ.png" alt /></p>
<h2 id="heading-tips-for-testing">Tips for Testing</h2>
<p>Now that you know the basics of testing GraphQL on Mobile API Tester, here are a few tips to keep in mind:</p>
<ul>
<li><p>First, ensure you are using the latest version of the Graph QL schema. If you are not, then update your schema and rerun your tests.</p>
</li>
<li><p>Second, check your resolvers. Make sure they are correctly resolving the data that you are querying for.</p>
</li>
<li><p>Third, ensure your Graph QL server is running and accessible. You can do this by checking the server logs.</p>
</li>
<li><p>Fourth, if you are using a mocked Graph QL server, ensure the mock data is correct.</p>
</li>
<li><p>When creating tests, always start with the most straightforward queries possible and gradually add complexity. This will help you narrow down any issues more quickly.</p>
</li>
<li><p>Pay attention to the structure of your queries and make sure they are well-formed. This includes using proper casing and indentation.</p>
</li>
<li><p>Make use of the "debug" mode in Mobile API Tester to see precisely what is being sent with each request. This can be helpful for troubleshooting purposes.</p>
</li>
<li><p>Keep your tests organized by creating separate projects for each type of test (e.g., unit vs. integration). This will make it easier to find what you're looking for later.</p>
</li>
</ul>
<p>Following these tips, you should be able to test GraphQL on Mobile API Tester with no problems successfully.</p>
<h2 id="heading-why-api-tester-mobile-app">Why API Tester Mobile app?</h2>
<p>API tester mobile app is the best for API testing on <a target="_blank" href="https://play.google.com/store/apps/details?id=apitester.org">Android</a> and <a target="_blank" href="https://apps.apple.com/us/app/api-tester-debug-requests/id1575521212">iOS</a> devices because:</p>
<ul>
<li><p>It has a simple and easy-to-use interface that makes it easy to test your APIs.</p>
</li>
<li><p>The app provides real-time feedback so you can see how your APIs are performing in actual use.</p>
</li>
<li><p>It's fast and efficient, so you can quickly test multiple APIs.</p>
</li>
</ul>
<p>API Tester Mobile app has been specifically designed to help developers test their APIs.</p>
<p>The app provides several features that make it easy to simulate real user interaction with your APIs.</p>
<p>For example, you can generate requests and responses, view logs, and track user interactions. The app also has a built-in debugger that makes exploring any errors during the testing process easy.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>In this article we discussed how to test GraphQL API using the API Tester Mobile app. This is a must-have tool if you are working with API. It can help you troubleshoot issues. The app provides rich feedback so you can always know what is happening with your requests and responses everywhere in the world.</p>
<p>If you enjoyed this article, then don't forget to give ❤️ and Bookmark 🏷️for later use and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>Connect with me</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Twitter</td><td>GitHub</td><td>LinkedIn</td><td>Instagram</td><td>Website</td><td>Newsletter</td><td>Support</td></tr>
</thead>
<tbody>
<tr>
<td><a target="_blank" href="https://twitter.com/j471n_"><img src="https://cdn-icons-png.flaticon.com/64/4494/4494477.png" alt /></a></td><td><a target="_blank" href="https://github.com/j471n"><img src="https://cdn-icons-png.flaticon.com/64/2504/2504911.png" alt /></a></td><td><a target="_blank" href="https://www.linkedin.com/in/j471n/"><img src="https://cdn-icons-png.flaticon.com/64/3536/3536505.png" alt /></a></td><td><a target="_blank" href="https://instagram.com/j471n_"><img src="https://cdn-icons-png.flaticon.com/64/174/174855.png" alt /></a></td><td><a target="_blank" href="https://j471n.in"><img src="https://cdn-icons-png.flaticon.com/64/3178/3178285.png" alt /></a></td><td><a target="_blank" href="https://www.getrevue.co/profile/j471n"><img src="https://cdn-icons-png.flaticon.com/64/5822/5822078.png" alt /></a></td><td><a target="_blank" href="https://www.buymeacoffee.com/j471n"><img src="https://cdn-icons-png.flaticon.com/64/2935/2935413.png" alt /></a></td></tr>
</tbody>
</table>
</div>]]></content:encoded></item><item><title><![CDATA[Chrome Extensions of the Month - November 2022]]></title><description><![CDATA[In this article, I will suggest to you some of the best extensions you need to install for better productivity that can come in very handy. So without further due, let's get into it.
1. Simplify Gmail
Brought to you by the co-founder and design lead ...]]></description><link>https://hashnode.j471n.in/chrome-extensions-of-the-month-november-2022</link><guid isPermaLink="true">https://hashnode.j471n.in/chrome-extensions-of-the-month-november-2022</guid><category><![CDATA[Productivity]]></category><category><![CDATA[chrome extension]]></category><category><![CDATA[Chrome Extensions of the Month]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Wed, 30 Nov 2022 05:30:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1668844467132/pyTtsKZLZ.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I will suggest to you some of the best extensions you need to install for better productivity that can come in very handy. So without further due, let's get into it.</p>
<h2 id="heading-1-simplify-gmail">1. Simplify Gmail</h2>
<p>Brought to you by the co-founder and design lead for Google Inbox, <a target="_blank" href="https://chrome.google.com/webstore/detail/simplify-gmail/pbmlfaiicoikhdbjagjbglnbfcbcojpj">Simplify Gmail</a> is a browser extension for desktop Gmail that boosts productivity, strengthens privacy, and reduces️ stress. It makes the Gmail very simple in UI and more productive.</p>
<p><img src="https://lh3.googleusercontent.com/MS5EZsoGs_Jqi_j00TX8FnFi_Tdghne4dfpDNLvoVbNKOVE3gz2LTRMHbD7wXPi26oBeMlACYzS1eYwAk3arNHSXeA=w640-h400-e365-rj-sc0x00ffffff" alt="Simplify Gmail" /></p>
<h2 id="heading-2-bardeen">2. Bardeen</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/bardeen-automate-workflow/ihhkmalpkhkoedlmcnilbbhhbhnicjga">Bardeen</a> is a no-code workflow automation app that replaces your repetitive tasks with a single shortcut. Connect your favorite web apps and build custom automations in minutes. </p>
<p>Suggested By - <a target="_blank" href="https://dev.to/dochan">@dochan</a></p>
<p><img src="https://lh3.googleusercontent.com/TVBzwPMLMxn_vND09BUKjCERsa6-qL4TbCJVUetk9yGOuM_GvsXebePz6z-cgHf_EGpjAls25y9OAQ936pNk0bMyRA=w640-h400-e365-rj-sc0x00ffffff" alt="Bardeen" /></p>
<h2 id="heading-3-let-me-read-that-article">3. Let Me Read That Article</h2>
<p>Do you hate it when you want to read an article ad free, but the website says, "looks like you're using an ad-blocker"? Or when you have a limited number of reads on a news website until you have to subscribe? Same here, so here's an extension that will intercept those annoying popups and let you read that article.</p>
<p><strong><a target="_blank" href="https://chrome.google.com/webstore/detail/let-me-read-that-article/bmdnpacffafhifoibkeajbacaapgcoih">Download</a></strong></p>
<p><img src="https://lh3.googleusercontent.com/FXQ_ZyUmuT7TItRnmiNOEBBlFl46ZG9REqIobYyWFuAAOjv6MMukSn08Hkrch3bcpPUKXtNVtKUceY5fj0PrYrJr=w640-h400-e365-rj-sc0x00ffffff" alt="Let Me Read That Article" /></p>
<p><img src="https://lh3.googleusercontent.com/qkinNy_ss__MgFaKQNhXhBQeXIJeGno2l6Dntodvet4WW_IZAi1JXZ_jme1HMWTQLBUiim5oOa2ZftuBl01M9_Y3KyU=w640-h400-e365-rj-sc0x00ffffff" alt="lemme read" /></p>
<h2 id="heading-4-image-download-center">4. Image download center</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/image-download-center/deebfeldnfhemlnidojiiidadkgnglpi">Image Download Center</a> - saves your time when you want to download images from a webpage. </p>
<p>Features:</p>
<ul>
<li>Download all images</li>
<li>Supports many formats including PNG, JPEG, SVG, WEBP</li>
<li>Filter by size (you can filter out website logos and design elements)</li>
<li>Preserves file name</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/K9kZUfAxrnaadvGZ50BxsEb1SVtz0RvCo6PNWGIzoHkOExs2zcTeoQUFkyv0r4PZSTT8Ov2tsvp0_i5k8hZlr3JYXyQ=w640-h400-e365-rj-sc0x00ffffff" alt="Image download center" /></p>
<h2 id="heading-5-paint-tool">5. Paint Tool</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/paint-tool-marker-for-chr/nadohmjilefnhjobhhlnnddplaklmnnp">Paint Tool</a> - is a simple to use free extension that allows you to create and save quick and fun drawings while using Chrome! It can also be used as a Full Page screenshot tool.</p>
<p><img src="https://lh3.googleusercontent.com/KN2SRMkwOB0bmtY-N3tloAdcKaSBY4Gp3CxDnKfH7qeKRS3jdRurroPz-yzbUAjYYtTxnCTO9jxjdnoPMdnTR0Lvfw=w640-h400-e365-rj-sc0x00ffffff" alt="Paint Tool " /></p>
<h2 id="heading-6-selenium-ide">6. Selenium IDE</h2>
<p>The <a target="_blank" href="https://chrome.google.com/webstore/detail/selenium-ide/mooikfkahbdckldjjndioackbalphokd">Selenium IDE</a> is designed to record your interactions with websites to help you generate and maintain site automation, tests, and remove the need to manually step through repetitive takes.</p>
<p><img src="https://lh3.googleusercontent.com/8TvMgoN4USfvq_AMf_QWoExfjNQv-j3OLdFMD8OfWgMluDyHyVc492A6ZbqWIO52qlMBeOz_HgkCM9ePG9Ul6I7xYtQ=w640-h400-e365-rj-sc0x00ffffff" alt="Selenium IDE" /></p>
<h2 id="heading-7-color-by-fardos">7. Color by Fardos</h2>
<p>Pick colors from websites, save colors &amp; gradients, get matching shades and tints and create beautiful gradients. It's my favorite color picker.</p>
<p><strong><a target="_blank" href="https://chrome.google.com/webstore/detail/color-by-fardos-color-pic/iibpgpkhpfggipbacjfeijkloidhmiei">Download</a></strong></p>
<p><img src="https://lh3.googleusercontent.com/RquFxAKv5ve0Jzeqt9ttsxWPZTPlScaMW4qM1VIxLmsPaC94BhcMJso6NbQKrTT4gGUD8JhCQB-KatExJBZLFMEzkW0=w640-h400-e365-rj-sc0x00ffffff" alt="Color by Fardos" /></p>
<p><img src="https://lh3.googleusercontent.com/IhSwctg2_czBu29vq9w0NLpQ3rDKCEtiiGR2pKZmmJqjCvZDIy2GxAxVe2N2v6r771nRtGBhuRR7kGCBNCNbip6c=w640-h400-e365-rj-sc0x00ffffff" alt="Color picker" /></p>
<h2 id="heading-8-pixelzoomer">8. PixelZoomer</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/pixelzoomer/fogkjckfkdcnmnnfmbieljpkmmihhpao">PixelZoomer</a> takes a screenshot of the current website and provides various tools for pixel analysis. You can zoom into websites (up to 3200%), measure distances and pick colors with an eye dropper.</p>
<p><img src="https://lh3.googleusercontent.com/rscXfBzRikjz0CQwOYU5cwUB77Ja9WwY9a6alF1Fjh8fgA9MAQUzmqqEVXWeVW4nstgMHeNm1TpPitZrQerVn7XOmg=w640-h400-e365-rj-sc0x00ffffff" alt="PixelZoomer" /></p>
<h2 id="heading-9-spantree">9. SpanTree</h2>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/spantree-gitlab-tree/gcjikeldobhnaglcoaejmdlmbienoocg">SpanTree</a> makes navigating a GitLab repository feel like a breeze by providing a familiar tree structure.</p>
<p>Features</p>
<ul>
<li>Easy to navigate tree structure</li>
<li>Resize the tree to your convenience</li>
<li>Supports self-hosted GitLab instances (Along with compatibility mode for GitLab v12 and less)</li>
<li>Lazy loaded file structure for a fast responsive user interface</li>
<li>Inbuilt Dark Theme for GitLab</li>
<li>Quick Search your Repository (using Ctrl/⌘ + P)</li>
</ul>
<p><img src="https://lh3.googleusercontent.com/tVJm8rdusGtdVbWT6d3qnbE0ilLWWqQ2XfjDbCAr8lPVEqhb548mw8nOjwYoD4_Z7vVkTbkQHFYyNHmy-jYB2YNzxg=w640-h400-e365-rj-sc0x00ffffff" alt="SpanTree" /></p>
<p><img src="https://lh3.googleusercontent.com/3s2vRE54FhLfdGQjDQ9eFhoM6eff4QoGO7cFRKtxVkrfhYOI4Vg6PLB8CiX91cw4uHHJiOhiZ3wvCjDuUiXdfXJZ=w640-h400-e365-rj-sc0x00ffffff" alt="spantree -1 " /></p>
<h2 id="heading-10-briskine">10. Briskine</h2>
<p>Write emails faster! Increase your productivity with templates and keyboard shortcuts on Gmail, Outlook, or LinkedIn.</p>
<p><strong><a target="_blank" href="https://chrome.google.com/webstore/detail/briskine-email-templates/lmcngpkjkplipamgflhioabnhnopeabf">Download</a></strong></p>
<p><img src="https://lh3.googleusercontent.com/6qc8rP4r7JknInSxSxo9ZEcyLde5uls_uW8ZY6zyyggteTANS4fA88J-ng9ggFgHCUoUyEatRUsRqxvwQSmyuiZY=w640-h400-e365-rj-sc0x00ffffff" alt="Briskine" /></p>
<h2 id="heading-wrapping-up">Wrapping up</h2>
<p>These were some extensions for this month (November 2022). You might have heard some before, but if you like anyone then don't forget to press ❤️. I have personally used all the above extensions and from my experience, every extension is worth installing.</p>
]]></content:encoded></item><item><title><![CDATA[How to Access Local Sever on Other Devices]]></title><description><![CDATA[In this article, I am going to show you how you can access your local/localhost server on any other device (Android or iOS). 
To access your local server, you only one thing IP Address of the device where the server is running. Now there could be two...]]></description><link>https://hashnode.j471n.in/how-to-access-local-sever-on-other-devices</link><guid isPermaLink="true">https://hashnode.j471n.in/how-to-access-local-sever-on-other-devices</guid><category><![CDATA[Web Development]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[React]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Sat, 26 Nov 2022 06:51:54 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1669444573695/lX68d4F98.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I am going to show you how you can access your local/localhost server on any other device (Android or iOS). </p>
<p>To access your local server, you only one thing <strong>IP Address</strong> of the device where the server is running. Now there could be two scenarios where you are using Windows or Mac. You just need to get the IP Address. Let me show you how:</p>
<p>Open windows terminal and type <code>ipconfig</code> in the command line and you will get the following output:</p>
<p><img src="https://i.imgur.com/VSkhF2w.png" alt /><br />You only need an IPv4 address and as you get it not type this in your mobile browser followed by <code>PORT</code>. For instance-  </p>
<pre><code class="lang-bash"><span class="hljs-comment"># IPv4:PORT </span>
192.168.64.201:3000
</code></pre>
<p>And if you are running any web app on <code>localhost:3000</code> then you will be able to see that on your mobile devices also.</p>
<p>For <strong>Mac users</strong> you have to do the same-</p>
<ul>
<li>Get the IPv4 (use <code>ifconfig</code> command)</li>
<li>Put that on your mobile device followed by <code>PORT</code></li>
</ul>
<p>And hurray!!!</p>
<p>If you are unable to fine the mac IP address then you can take a look the following article: </p>
<p><a target="_blank" href="https://www.wikihow.com/Find-Your-IP-Address-on-a-Mac">How to Find Your IP Address on a Mac</a></p>
<p>Following is the Video demo of how it works:
<img src="https://imgur.com/QEAyiwr.gif" alt="Demo" /></p>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>That's all you need to run you localhost server on other devices.  If you enjoyed this article, then don't forget to give ❤️  and if you have any questions or feedback then don't hesitate to drop them in the comments below. I'll see in the next one.</p>
<p><strong>🌐 Connect with me:</strong></p>
<p><a target="_blank" href="https://twitter.com/j471n_">Twitter</a><br /><a target="_blank" href="https://github.com/j471n">Github</a><br /><a target="_blank" href="https://www.instagram.com/j471n_/">Instagram</a><br /><a target="_blank" href="https://www.getrevue.co/profile/j471n">Newsletter</a><br /><a target="_blank" href="https://www.linkedin.com/in/j471n/">LinkedIn</a><br /><a target="_blank" href="https://j471n.in/">Website</a><br /><a target="_blank" href="https://buymeacoffee.com/j471n">Buy me a Coffee</a></p>
]]></content:encoded></item><item><title><![CDATA[CSS Battle: #16 - Eye of the Tiger]]></title><description><![CDATA[In this article, I will solve a Eye of the Tiger CSS Challenge on CSS Battle. Let's look at the problem first.
Problem
We need to create the following container by using CSS Properties only:

Solution
So now look at the Solution and how we are going ...]]></description><link>https://hashnode.j471n.in/css-battle-16-eye-of-the-tiger</link><guid isPermaLink="true">https://hashnode.j471n.in/css-battle-16-eye-of-the-tiger</guid><category><![CDATA[CSS]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[webdev]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Jatin Sharma]]></dc:creator><pubDate>Sat, 19 Nov 2022 08:51:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1668847831258/wUM0Sinn-.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I will solve a <a target="_blank" href="https://cssbattle.dev/play/16">Eye of the Tiger</a> CSS Challenge on <a target="_blank" href="https://cssbattle.dev">CSS Battle</a>. Let's look at the problem first.</p>
<h2 id="heading-problem">Problem</h2>
<p>We need to create the following container by using CSS Properties only:
<img src="https://cssbattle.dev/targets/16.png" alt="Eye of the Tiger" /></p>
<h2 id="heading-solution">Solution</h2>
<p>So now look at the Solution and how we are going to achieve this. </p>
<h3 id="heading-html">HTML</h3>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">c</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">l</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">r</span>&gt;</span>
</code></pre>
<ul>
<li><code>&lt;p c&gt;</code> : Center Circle</li>
<li><code>&lt;p l&gt;</code> : Left Triangle</li>
<li><code>&lt;p r&gt;</code> : Right Triangle</li>
</ul>
<h3 id="heading-css">CSS</h3>
<pre><code class="lang-css">* {
  <span class="hljs-attribute">margin</span>: <span class="hljs-number">0</span>;
  <span class="hljs-attribute">background</span>: <span class="hljs-number">#0b2429</span>;
}

<span class="hljs-selector-tag">body</span> {
  <span class="hljs-attribute">display</span>: grid;
  <span class="hljs-attribute">place-items</span>: center;
}

<span class="hljs-selector-tag">p</span> { <span class="hljs-attribute">position</span>: absolute }

<span class="hljs-selector-attr">[c]</span> {
  <span class="hljs-attribute">width</span>: <span class="hljs-number">50</span>;
  <span class="hljs-attribute">height</span>: <span class="hljs-number">50</span>;
  <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">1in</span>;
  <span class="hljs-attribute">border</span>: <span class="hljs-number">45px</span> solid <span class="hljs-number">#f3ac3c</span>;
  <span class="hljs-attribute">box-shadow</span>: <span class="hljs-number">0</span> <span class="hljs-number">0</span> <span class="hljs-number">0</span> <span class="hljs-number">20px</span> <span class="hljs-number">#0b2429</span>, 
              <span class="hljs-number">0</span> <span class="hljs-number">0</span> <span class="hljs-number">0</span> <span class="hljs-number">30px</span> <span class="hljs-number">#998235</span>;
  <span class="hljs-attribute">z-index</span>: <span class="hljs-number">1</span>;
}

<span class="hljs-selector-attr">[l]</span>, <span class="hljs-selector-attr">[r]</span> {
  <span class="hljs-attribute">height</span>: <span class="hljs-number">160</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">82</span>;
  <span class="hljs-attribute">clip-path</span>: <span class="hljs-built_in">polygon</span>(<span class="hljs-number">0</span> <span class="hljs-number">50%</span>, <span class="hljs-number">100%</span> <span class="hljs-number">100%</span>, <span class="hljs-number">100%</span> <span class="hljs-number">0</span>);
  <span class="hljs-attribute">background</span>: <span class="hljs-number">#998235</span>;
}

<span class="hljs-selector-attr">[l]</span> { <span class="hljs-attribute">left</span>: <span class="hljs-number">58</span> }

<span class="hljs-selector-attr">[r]</span> {
  <span class="hljs-attribute">right</span>: <span class="hljs-number">57</span>;
  <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">scalex</span>(-<span class="hljs-number">1</span>);
}
</code></pre>
<blockquote>
<p><small>Note: In CSS Battle you can use <code>100</code> instead of <code>100px</code>. You don't need to define <code>px</code> in CSS. However, if you are using <code>rem</code> or <code>%</code>, you need to pass them separately. That's why in the above CSS code there are no units mostly. For more info <a target="_blank" href="https://cssbattle.dev/tips">visit here</a></small></p>
<p><small>Minify the code or CSS by using any <a target="_blank" href="https://www.minifier.org/">CSS Minifier</a>. It helps you to reduce the characters in the code which will increase the score.</small></p>
</blockquote>
<p><strong>Minified Version:</strong></p>
<pre><code>&lt;p c&gt;&lt;p l&gt;&lt;p r&gt;&lt;style&gt;*{margin:0;background:#0B2429}body{display:grid;place-items:center}p{position:absolute}[c]{width:50;height:50;border-radius:1in;border:45px solid #F3AC3C;box-shadow:0 0 0 20px #0B2429,0 0 0 30px #998235;z-index:1}[l],[r]{height:160;width:82;clip-path:polygon(0 50%,100% 100%,100% 0);background:#998235}[l]{left:58}[r]{right:57;transform:scalex(-1)}
</code></pre><div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/j471n_/status/1593888944537890816">https://twitter.com/j471n_/status/1593888944537890816</a></div>
<h3 id="heading-wrapping-up">Wrapping up</h3>
<p>There are many ways to solve this. You can share your approach in the comments. If you like this then don't forget to ❤️ it. And I'll see you in the next article. See you soon.</p>
]]></content:encoded></item></channel></rss>