<?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[Parull Kohhli]]></title><description><![CDATA[Parull Kohhli]]></description><link>https://blogs.parullkohhli.com</link><generator>RSS for Node</generator><lastBuildDate>Sun, 17 May 2026 05:59:22 GMT</lastBuildDate><atom:link href="https://blogs.parullkohhli.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[The Secret Highway of Data: Tracked!]]></title><description><![CDATA[🕵️ When You Search "Netflix"... What Actually Happens?
You go to Google.You type "Netflix".You click the first link.
And just like that — https://www.netflix.com opens.

But pause. Think for a second.
What just happened?How did that website open?And...]]></description><link>https://blogs.parullkohhli.com/the-secret-highway-of-data-tracked</link><guid isPermaLink="true">https://blogs.parullkohhli.com/the-secret-highway-of-data-tracked</guid><category><![CDATA[internet]]></category><category><![CDATA[domain]]></category><category><![CDATA[server]]></category><category><![CDATA[ChaiCode]]></category><category><![CDATA[web]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Mon, 14 Jul 2025 18:30:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1742762136263/1f7de065-abbd-48bb-a364-09a77f85eb66.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-when-you-search-netflix-what-actually-happens">🕵️ When You Search "Netflix"... What <em>Actually</em> Happens?</h3>
<p>You go to Google.<br />You type <strong>"Netflix"</strong>.<br />You click the first link.</p>
<p>And just like that — <a target="_blank" href="https://www.netflix.com"><code>https://www.netflix.com</code></a> opens.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742746125224/3bc0efca-4be9-450f-b2f5-2cfc1398ee29.png" alt class="image--center mx-auto" /></p>
<p>But pause. Think for a second.</p>
<p><strong>What just happened?</strong><br /><strong>How did that website open?</strong><br />And more importantly — <strong>how are you able to binge-watch an entire series without even thinking about it?</strong></p>
<p>Well, without data being transferred behind the scenes, <strong>nothing</strong> would load. Not a single episode. Not a thumbnail. Not even the homepage.</p>
<p>🌐 So… How? Where? And Who’s Involved?</p>
<p>Let’s break it down.</p>
<p>When you open Netflix — whether on your <strong>laptop</strong>, <strong>tablet</strong>, or <strong>phone</strong> — your device is the one <em>asking</em> for data.</p>
<p>In technical terms, your device becomes the <strong>client</strong>.</p>
<p>We can represent it like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742746527476/c5641a28-1552-4213-8922-5b281eb190fc.png" alt class="image--center mx-auto" /></p>
<p>This client (your browser/device) sends out a request:<br /><strong>“Hey, I want to watch a show on</strong> <a target="_blank" href="http://netflix.com"><strong>netflix.com</strong></a> <strong>— help me find it and bring the content back!”</strong></p>
<p>But who does it ask? How does it know where Netflix lives ?</p>
<p>Let’s dive deeper into the hidden data journey — where it travels, who guides it, and how it returns to you in the form of a show you can’t stop watching.</p>
<h2 id="heading-what-happens-after-the-click">🌐 What Happens After the Click?</h2>
<p>As soon as you click on the URL <a target="_blank" href="http://www.netflix.com"><code>www.netflix.com</code></a>, your device (the client) doesn’t magically know where to go.</p>
<p>Instead, it sends out a request —<strong>"Where is this website located?"</strong><br />And this request goes to something called the <strong>DNS</strong> — <em>Domain Name System</em>.</p>
<p>Let’s represent it like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742746958577/c2105584-9a6e-42e4-ad05-ce304c192392.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-wait-what-is-dns-server-anyway">🧠 Wait — What <em>Is</em> DNS Server Anyway?</h2>
<p>Before we continue down the data journey, let’s quickly understand what DNS Server actually does.</p>
<p>Think of it like your <strong>phone’s contact list</strong>.</p>
<p>You don’t remember everyone’s phone number, right? You just tap on a name like "Muskaan" and your phone dials the correct number behind the scenes.</p>
<p>In the same way, <a target="_blank" href="http://Netflix.com"><strong>Netflix.com</strong></a> is just a name.<br />The real identifier is something called an <strong>IP address</strong>*(It’s the contact number in the world of internet)* — something like <code>192.0.2.1</code>.</p>
<p>So far, here’s what’s happened:</p>
<ul>
<li><p>You typed <a target="_blank" href="http://netflix.com"><code>netflix.com</code></a> into your browser.</p>
</li>
<li><p>Your device (client) sent a request to the <strong>DNS</strong> Server.</p>
</li>
<li><p>Now the DNS Server has a job: to <strong>find out where</strong> <a target="_blank" href="http://netflix.com"><strong>netflix.com</strong></a> <strong>lives</strong>.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742756785261/4bdddc63-a5df-4297-a095-adfd4bb4b98c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-so-whats-the-dns-server-next-step">So what's the DNS Server next step?</h3>
<p>It reaches out to the <strong>Root Server</strong>.</p>
<h2 id="heading-dns-server-contacts-the-root-server">🌳 DNS Server Contacts the Root Server</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742757904961/2994982b-76e3-4fa8-a1f2-bbb66144dc2d.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-what-is-a-root-server">🌍 What is a Root Server?</h3>
<p>Think of it like the <strong>root of a tree</strong> — the very base from where all paths begin.<br />Just like a tree distributes nutrients through branches, the <strong>Root Server directs DNS traffic</strong> to where it needs to go next.</p>
<p>There are <strong>13 main root servers</strong> around the world (named A–M) and they have further sub-servers as well.</p>
<h3 id="heading-but-what-do-root-servers-actually-do">🧭 But What Do Root Servers Actually Do?</h3>
<p>Root servers <strong>don’t know the final IP</strong> of <a target="_blank" href="http://netflix.com"><code>netflix.com</code></a> — but they know where to find the next clue. Think of it like a scavenger hunt.</p>
<p>They store mappings for <strong>Top-Level Domains (TLDs)</strong> — like:</p>
<ul>
<li><p><code>.com</code></p>
</li>
<li><p><code>.net</code></p>
</li>
<li><p><code>.org</code></p>
</li>
<li><p><code>.in</code></p>
</li>
<li><p><code>.us</code></p>
</li>
</ul>
<p>So when DNS Server asks, “Where is <a target="_blank" href="http://netflix.com"><strong>netflix.com</strong></a>?”,<br />the root server replies: 🗣️ “I don’t know where <a target="_blank" href="http://netflix.com"><strong>netflix.com</strong></a> lives, but I can point you to the <strong>.com TLD server</strong> — it might know!”</p>
<h2 id="heading-the-root-server-brings-a-clue">🧩 The Root Server Brings a Clue</h2>
<p>So, the DNS Server asked the <strong>Root Server</strong>:<br />“Where can I find <a target="_blank" href="http://netflix.com"><strong>netflix.com</strong></a>?”</p>
<p>The Root Server responds:<br />🗣️ <em>“I don’t know exactly where</em> <a target="_blank" href="http://netflix.com"><strong><em>netflix.com</em></strong></a> <em>is, but I do know who handles all</em> <code>.com</code> domains. Here’s their contact!”</p>
<p>In tech terms, the <strong>Root Server shares the IP address</strong> of the <code>.com</code> TLD server — the next stop in the journey.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742758098862/8770554e-2cc0-4dbb-b1a8-a6d1cb2a0235.png" alt class="image--center mx-auto" /></p>
<p>So, it's like the Root Server hands the DNS Server a clue and says:</p>
<p>🔎 <em>“I didn’t solve the mystery, but here’s the next lead.”</em></p>
<p>This clue gets passed back to the DNS Server .</p>
<p>Now the DNS Server knows who to ask next — the <strong>.com TLD server(in our case server with .com addresses)</strong>, which might just have the answer we’re looking for.</p>
<h2 id="heading-the-tld-server-finds-the-host">🔍The TLD Server Finds the Host</h2>
<p>Now the DNS Server takes the clue from the Root Server and heads over to the <strong>TLD Server</strong> — in this case, the one responsible for <strong>.com</strong> domains.</p>
<p>So it asks the <code>.com</code> TLD server:<br />🗣️ <em>“Hey, I’m looking for</em> <a target="_blank" href="http://netflix.com"><strong><em>netflix.com</em></strong></a><em>. Do you know where it lives?”</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742759078058/535999a5-8ff4-473a-bbed-b1a238e1cf3f.png" alt class="image--center mx-auto" /></p>
<p>The TLD server responds:<br />✅ <em>“Yes! I don’t know the exact house, but I know the person who owns it. Here’s the address of the</em> <strong><em>authoritative name server</em></strong> <em>for</em> <a target="_blank" href="http://netflix.com"><em>netflix.com</em></a><em>.”</em></p>
<p>This <strong>authoritative name server</strong> is typically managed by the company where the domain is registered or hosted — like <strong>GoDaddy</strong>, <strong>Namecheap</strong>, <strong>Cloudflare</strong>, <strong>AWS</strong> , etc.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742759297329/8d975840-0704-4c8f-a61c-2211bbd6923c.png" alt class="image--center mx-auto" /></p>
<p>And this server?<br />It holds the final, most important piece of the puzzle:<br />T<strong>he actual IP address of</strong> <a target="_blank" href="http://netflix.com"><strong>netflix.com</strong></a> — the true digital home where the site is hosted.</p>
<h2 id="heading-the-authoritative-name-server-final-answer">🧠 The Authoritative Name Server — Final Answer</h2>
<p>We’re now holding three clues:</p>
<ul>
<li><p>The browser asked the <strong>DNS server</strong>,</p>
</li>
<li><p>The resolver asked the <strong>Root Server</strong>,</p>
</li>
<li><p>The Root pointed to the <strong>TLD Server (.com)</strong>,</p>
</li>
<li><p>And the TLD Server gave us a lead:<br />  <em>“Ask the Authoritative Name Server. It knows it all.”</em></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742759847411/5ef563c2-0e27-4e24-b2f1-f49cac90b35b.png" alt class="image--center mx-auto" /></p>
<p>So now, the DNS Server heads to the <strong>authoritative name server</strong> —<br />Let’s say, for example, Netflix is hosted on <strong>AWS Route 53</strong> (very likely, since AWS is one of the biggest DNS providers).</p>
<p>🕵️ The resolver now asks:<br /><em>“Hey Authoritative Server, I’ve followed every clue — can you finally tell me the IP address of</em> <a target="_blank" href="http://netflix.com"><strong><em>netflix.com</em></strong></a><em>?”</em></p>
<p>And the authoritative server responds:<br />✅ “Yes. Here you go — Netflix lives at <strong>[actual IP address]</strong>.”</p>
<p>💡 Boom! We now have the <strong>exact coordinates</strong> of where Netflix is hosted.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742759954762/36724d36-4248-444b-b807-4999d9012740.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-mission-complete">💾 Mission Complete</h2>
<p>Now that the DNS server has the final IP address, it sends that information <strong>all the way back to your browser</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1742760327285/91aa5469-adbd-4b29-93c4-c48ea4db6e7d.png" alt class="image--center mx-auto" /></p>
<p><strong>Step 7</strong> , At this point, something powerful happens: The <strong>browser establishes a direct connection</strong> with the Netflix server at that IP address.</p>
<p>From here on, the client and server can now <strong>talk directly</strong> to each other.</p>
<p><strong>Step 8 &amp; 9:</strong> Let the Conversation Begin</p>
<p>With the connection open, your browser sends an actual <strong>HTTP request</strong> to the Netflix server —<br />something like: 👉 <em>“Hey, I want to load the homepage of</em> <a target="_blank" href="http://netflix.com"><em>netflix.com</em></a><em>!”</em></p>
<p>The server understands the request and responds with the necessary data — HTML, CSS, JavaScript, or even video stream chunks.</p>
<p>This <strong>two-way communication</strong> (request ↔ response) is what powers your Netflix experience.</p>
<p>📝 For simplicity, we show this to-and-fro as a single step idn the diagram, but just know: Your browser <strong>keeps talking</strong> to the server as long as it needs data (images, scripts, videos, etc.)</p>
<h2 id="heading-summary-the-secret-life-of-data-revealed">🧾 <strong>Summary: The Secret Life of Data — Revealed</strong></h2>
<p>Let’s recap the thrilling behind-the-scenes journey of what happens when you search and click on <a target="_blank" href="http://netflix.com"><strong>netflix.com</strong></a>:</p>
<ol>
<li><p><strong>Client Request:</strong><br /> Your browser (the <em>client</em>) sends a request for <a target="_blank" href="http://netflix.com"><code>netflix.com</code></a>.</p>
</li>
<li><p><strong>DNS</strong> Server <strong>Lookup Begins:</strong><br /> The request is sent to the <strong>DNS server</strong>, asking, “Where is <a target="_blank" href="http://netflix.com">netflix.com</a>?”</p>
</li>
<li><p><strong>Root Server Step:</strong><br /> The DNS Server contacts a <strong>Root Server</strong>, which points it to the <strong>.com TLD server</strong>.</p>
</li>
<li><p><strong>TLD Server Step:</strong><br /> The <strong>TLD server</strong> (for <code>.com</code>) gives the address of the <strong>authoritative name server</strong> for Netflix.</p>
</li>
<li><p><strong>Authoritative Server Response:</strong><br /> The <strong>authoritative name server</strong> provides the <strong>final IP address</strong> of <a target="_blank" href="http://netflix.com"><code>netflix.com</code></a> (e.g., hosted on AWS).</p>
</li>
<li><p><strong>DNS</strong> Server <strong>Sends Back IP:</strong><br /> This IP is returned to your <strong>browser</strong> — now it knows exactly where to go.</p>
</li>
<li><p><strong>Connection is Established:</strong><br /> The browser creates a direct <strong>TCP connection</strong> with the Netflix server.</p>
</li>
<li><p><strong>Data Request:</strong><br /> The browser sends an <strong>HTTP request</strong> to that IP asking for the homepage.</p>
</li>
<li><p><strong>Data Delivery:</strong><br /> The server responds with the required content — and the Netflix site starts loading on your screen.</p>
</li>
</ol>
<h3 id="heading-dns-resolution"><strong>DNS resolution</strong></h3>
<p>It is this process of <strong>translating a domain name</strong> (like <a target="_blank" href="http://netflix.com"><code>netflix.com</code></a>) into its corresponding <strong>IP address</strong> (like <code>52.94.134.119</code>) so that your browser can find and connect to the correct server.</p>
<p>The reverse of it is Reverse DNS Lookup</p>
<h3 id="heading-reverse-dns-lookup-rdns"><strong>Reverse DNS Lookup (rDNS)</strong></h3>
<p><strong>Reverse DNS</strong> is the <strong>opposite</strong> of the usual DNS process.</p>
<ul>
<li><p><strong>DNS (forward lookup):</strong><br />  <code>domain name → IP address</code><br />  <em>e.g.,</em> <a target="_blank" href="http://netflix.com"><em>netflix.com</em></a> <em>→ 52.94.134.119</em></p>
</li>
<li><p><strong>Reverse DNS (rDNS):</strong><br />  <code>IP address → domain name</code><br />  <em>e.g., 52.94.134.119 →</em> <a target="_blank" href="http://netflix.com"><em>netflix.com</em></a></p>
</li>
</ul>
<p>This reverse lookup uses a <strong>PTR (Pointer) record</strong>.</p>
<p>Mail servers use rDNS to check if the sender’s IP actually maps to a legitimate domain.</p>
<p>Example:You receive an email from <a target="_blank" href="mailto:xyz@bank.com"><code>xyz@bank.com</code></a>, but the IP address doesn't go to <a target="_blank" href="http://bank.com">bank.com</a>.<br />The server may flag or reject the email as <strong>suspicious</strong>.</p>
<h2 id="heading-bonus">BONUS</h2>
<p><strong>DNS Record</strong> is a piece of information stored in DNS servers that tells the internet how to handle requests for a domain — like where to find the website, send emails, or verify ownership.</p>
<p>The following are it’s types :</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>🔠 <strong>Record</strong></td><td>🔍 <strong>What It Does</strong></td><td>🌍 <strong>Real-World Analogy</strong></td><td>🧭 <strong>Where/When It's Used</strong></td></tr>
</thead>
<tbody>
<tr>
<td><strong>A</strong></td><td>Maps domain → IPv4 address</td><td>Your physical home address</td><td>✅ <strong>Step 6 &amp; 7</strong> — returned by authoritative name server to resolver → client</td></tr>
<tr>
<td><strong>AAAA</strong></td><td>Maps domain → IPv6 address</td><td>Same as A, but for newer GPS systems</td><td>✅ <strong>Step 6 &amp; 7</strong> — used like A, if IPv6 is supported</td></tr>
<tr>
<td><strong>CNAME</strong></td><td>Alias one domain to another domain</td><td>Nickname redirect to main name</td><td>✅ <strong>Step 6</strong> — used inside authoritative server resolution</td></tr>
<tr>
<td><strong>MX</strong></td><td>Directs email to mail server</td><td>Mailroom address of a company</td><td>❌ Not used in web resolution; ✅ <strong>Used in email systems</strong></td></tr>
<tr>
<td><strong>TXT</strong></td><td>Stores text info (SPF/DKIM/verification)</td><td>Sticky note: “Only X can deliver here”</td><td>❌ Not for site load; ✅ <strong>Used in email + domain verification (Google, AWS)</strong></td></tr>
<tr>
<td><strong>NS</strong></td><td>Says which name servers are authoritative</td><td>Reception desk directory</td><td>✅ <strong>Step 3 (Root)</strong> &amp; <strong>Step 5 (TLD)</strong> — used to delegate &amp; point to authoritative server</td></tr>
<tr>
<td><strong>SOA</strong></td><td>Stores zone-level admin info</td><td>Receptionist’s private logbook</td><td>✅ Exists in <strong>Step 5–6</strong>, but <strong>used internally</strong> by DNS servers only</td></tr>
<tr>
<td><strong>PTR</strong></td><td>Maps IP → domain (Reverse DNS)</td><td>Caller ID for an incoming phone number</td><td>❌ Not in forward resolution; ✅ <strong>Used in reverse lookups, email anti-spam, logs</strong></td></tr>
<tr>
<td><strong>SRV</strong></td><td>Points to services (port+host)</td><td>Meeting room + floor</td><td>❌ Not in website resolution; ✅ <strong>Used in VoIP, Zoom, MS Teams</strong></td></tr>
<tr>
<td><strong>CAA</strong></td><td>Limits who can issue SSL certs</td><td>Authorization stamp for ID issuing</td><td>❌ Not part of DNS journey; ✅ <strong>Queried by Certificate Authorities during HTTPS setup</strong></td></tr>
</tbody>
</table>
</div><hr />
]]></content:encoded></item><item><title><![CDATA[Debouncing]]></title><description><![CDATA[Multiple API calls/renders on similar actions is an overhead to the browser and browser performance is a real concern in web-apps. Debouncing is a practice to improve the same. Let's learn about it in detail !!
DEBOUNCING
As the name suggests , if we...]]></description><link>https://blogs.parullkohhli.com/debouncing</link><guid isPermaLink="true">https://blogs.parullkohhli.com/debouncing</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[advanced]]></category><category><![CDATA[React]]></category><category><![CDATA[ReactHooks]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Sun, 29 Jun 2025 18:30:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1651449685328/mwj1ut2fE.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Multiple API calls/renders on similar actions is an overhead to the browser and browser performance is a real concern in web-apps. Debouncing is a practice to improve the same. Let's learn about it in detail !!</p>
<h5 id="heading-debouncing"><strong>DEBOUNCING</strong></h5>
<p>As the name suggests , if we want to execute a function or an action we will debounce(avoid) it, if <strong>similar</strong> action is executed within a given span of time(i.e delay).</p>
<p><strong>Real-Time Example</strong> : While naming a github-repository , the name availability is shown once you are done typing and not on every change of the alphabet in the name.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1651438377477/-m9gh4AGd.gif" alt="ezgif.com-gif-maker.gif" /></p>
<h5 id="heading-implementation"><strong>IMPLEMENTATION</strong></h5>
<p>To understand the implementation of debouncing , the knowledge in Closures and Decorators in JS is a must. So , assuming you are having a fair idea about it ,</p>
<ul>
<li><p>Debounce Function here is a Decorator.</p>
</li>
<li><p>As there is a closure , the <strong>timer variable</strong> is declared in debounce function , which is accessible in the inner function even after the debounce function has been popped out.</p>
</li>
</ul>
<pre><code class="lang-plaintext">const debounce = (fx, delay = 250) =&gt; {
    let timer;
    return function (...args) {
      if (timer) clearTimeout(timer);
      timer = setTimeout(() =&gt; {
        fx(...args);
      }, delay);
    };
  };
</code></pre>
<p>The timer(delay) is set as soon as any action has taken place. If before the delay hits 0 , a similar action takes place then we are clearing the previous timer and setting a new timer(delay) and so on , and hence avoiding the operation to happen until and unless no new similar action is being sent and the delay ends and hence the operation inside a function gets executed.</p>
<p>WHY WE DON'T DECLARE THE VARIABLE INSIDE THE NESTED FUNCTION?</p>
<ul>
<li>If it's declared inside the the nested function , it would be redeclared every time and you would'nt be able to clear the timer.</li>
</ul>
<p>WHY ARE WE PASSING ARGS ? WHY ARE WE SPREADING THOSE ?</p>
<ul>
<li><p>Args are passed to make the debounce function generic , as a function that is being passed in the debounce function can and cannot have arguments . So , instead of writing a separate debounce function , we are making it generic.</p>
</li>
<li><p>We are spreading the arguments , to give us a liberty to pass multiple arguments in a single argument.</p>
</li>
</ul>
<h5 id="heading-explanation-in-terms-of-event-loop"><strong>EXPLANATION IN TERMS OF EVENT LOOP</strong></h5>
<p>The method goes to the queue and then is sent to the stack , where it waits for the delay to hit zero , if another similar action happens the reference to the method(action) is cleared , hence making the stack empty or if no similar action happens , after the delay finishes , it gets executed.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1651445790216/Bbmn4jFJ-.jpg" alt="Untitled (1).jpg" /></p>
<h5 id="heading-real-time-application"><strong>REAL TIME APPLICATION</strong></h5>
<ul>
<li><p>Suggestion in search box</p>
</li>
<li><p>Auto-Save in text fields.</p>
</li>
<li><p>Screen Resizing</p>
</li>
<li><p>Page Scrolling</p>
</li>
<li><p>Show mouse position</p>
</li>
<li><p>Excessive calculations or API calls</p>
</li>
</ul>
<p>Screen resizing , in normal manner and then via debouncing the function.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1651442037246/2INZovJrB.gif" alt="ezgif.com-gif-maker (1).gif" /></p>
<p>If the function for updation was called without being debounced it would result in 'n' number of DOM renders, which is way more than the function being called via debouncing. Hence improving the performance of an action 'n' times.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://codesandbox.io/s/debounce-window-resize-rqvo4c?file=/src/App.js:669-966">https://codesandbox.io/s/debounce-window-resize-rqvo4c?file=/src/App.js:669-966</a></div>
<p> </p>
<h5 id="heading-summary"><strong>SUMMARY</strong></h5>
<p>Debouncing is a practice to avoid SIMILAR multiple actions and make it happen and not to delay those.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1651444284278/GODxqy-Z7.jpg" alt="Debouncing (2).jpg" /></p>
]]></content:encoded></item><item><title><![CDATA[Pseudo- Classes & Elements]]></title><description><![CDATA[Pseudo means 'false' .
Pseudo Classes and Pseudo Elements are special types of selectors. 
Why does Pseudo Elements and Classes called so ?
As we know what Pseudo means , so pseudo elements and classes mean that these  actually do not technically exi...]]></description><link>https://blogs.parullkohhli.com/pseudo-classes-elements</link><guid isPermaLink="true">https://blogs.parullkohhli.com/pseudo-classes-elements</guid><category><![CDATA[iwritecode]]></category><category><![CDATA[CSS3]]></category><category><![CDATA[HTML5]]></category><category><![CDATA[Pseudo-classes ]]></category><category><![CDATA[pseudo elements]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Fri, 18 Nov 2022 17:59:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1668623961804/WGRFxfEiP.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Pseudo means 'false' .</p>
<p>Pseudo Classes and Pseudo Elements are special types of selectors. </p>
<h4 id="heading-why-does-pseudo-elements-and-classes-called-so">Why does Pseudo Elements and Classes called so ?</h4>
<p>As we know what Pseudo means , so pseudo elements and classes mean that these  actually do not technically exist in the DOM in a i.e. these weren't inserted in the code ,it's added  with CSS. And hence the word Pseudo before their names.</p>
<h4 id="heading-what-are-pseudo-classes">WHAT ARE PSEUDO CLASSES?</h4>
<p>The pseudo classes are technically a condition or state on the selector. </p>
<pre><code><span class="hljs-comment">//Syntax</span>
<span class="hljs-attr">selector</span>:pseudo_class{

}
</code></pre><p>Now what does this mean ?
Let's understand with examples of Pseudo Classes -**</p>
<h5 id="heading-i-hoverhover">i) <strong>Hover</strong>(:hover)</h5>
<p>When the cursor goes on the button i.e. the hover state has become true or you can say the hover condition has been met the styling gets applied to the button element in the DOM or HTML.</p>
<p>REAL-TIME Example : AMAZON
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668796618503/Hy91wkofs.gif" alt="ezgif.com-gif-maker (2).gif" /></p>
<p>Example : On Hover the styling of the button changes</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668703904040/JnTeldsvB.gif" alt="Orange and White Funny Dating Animated Video Presentation (2).gif" /></p>
<pre><code><span class="hljs-comment">//It changes the styling when we hover(place the cursor) over an element</span>
<span class="hljs-attr">button</span>:hover{
<span class="hljs-attr">border</span>: <span class="hljs-number">2</span>px solid red;
border-radius: <span class="hljs-number">5</span>px;
color: red;
background-color:transparent;
}
</code></pre><h5 id="heading-ii-focusfocus">ii) <strong>Focus(:focus)</strong></h5>
<p>When the focus is in the element e.g. in input if the cursor is placed in the input box or in case of select element when the dropdown opens i.e. the focus is in the element of select then the styling is applied.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668703860727/jOv6P2O93.gif" alt="Orange and White Funny Dating Animated Video Presentation (1).gif" /></p>
<pre><code>      input:focus {
        font-size: <span class="hljs-number">2</span>em;
        background-color: #ff0000ec;
      }
</code></pre><p>There are multiple such pseudo classes , so a little work for you. 
Some pseudo classes work for links and have a order to override one's styling.
Try the same on <code>&lt;a&gt;</code> tag.
( HINT - LVHA order )</p>
<h4 id="heading-what-are-pseudo-elements">WHAT ARE PSEUDO ELEMENTS?</h4>
<p>Pseudo elements are used to style <strong>a part of selected element</strong>(via selector) unlike pseudo classes that style the entire element on a state/condition.</p>
<pre><code><span class="hljs-comment">//Syntax:</span>
<span class="hljs-attr">selector</span>::pseudo-element {
  <span class="hljs-attr">property</span>: value;
}
</code></pre><h5 id="heading-ifirst-letter-first-letter">i)First Letter (::first-letter)</h5>
<p>Add styling to the first letter/alphabet in the tag.</p>
<pre><code><span class="hljs-comment">//This changes the font-size and color of the first letter in &lt;p&gt;</span>
 <span class="hljs-attr">p</span>::first-letter {
        font-size: <span class="hljs-number">2</span>em;
        color: #<span class="hljs-number">8</span>a2be2;
      }
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668711024409/CrSWU09DV.jpg" alt="Hover Pseudo Selector.jpg" /></p>
<p>Unlike pseudo classes the styling is applied to a part of element(<code>&lt;p&gt;</code>) and not the entire <code>&lt;p&gt;</code> .</p>
<h5 id="heading-iibeforebefore">ii)<strong>Before(::before)</strong></h5>
<p>Using ::before after the selector allows us to add content or styling BEFORE the content of the elements and NOT the elements itself.
<code>content</code> property is a must to be present in the styling even its null i.e. ('').
If this property is missing the styling/content won't be visible.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668757088256/nrjlb9KG9.jpg" alt="Before Pseudo Selector (2).jpg" /></p>
<pre><code>Syntax:
selector::before{
<span class="hljs-attr">content</span> : content_value
}
<span class="hljs-comment">/* content_value can be "" , url() , open-quote etc. 
There are many options available.*/</span>

<span class="hljs-comment">//adds `"` before the CONTENT of &lt;h1&gt;</span>
  <span class="hljs-attr">h1</span>::before {
    <span class="hljs-attr">content</span>: open-quote;
  }
<span class="hljs-comment">//adds an * (depicting required field) before the &lt;label&gt;</span>
 <span class="hljs-attr">label</span>::before {
 <span class="hljs-attr">content</span>: <span class="hljs-string">"*"</span>;
    display: inline;
    color: #ff0000;
     font-size: <span class="hljs-number">2</span>em;
  }
</code></pre><p>Now there is a misconception that using ::before will add the things before the element, but it's not the case.
It adds up before the Content of the Element and not the Element.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668756506435/6Q9Xqhufy.jpg" alt="Before Pseudo Selector (1).jpg" /></p>
<p>NOTE: Multiple values in content can also be added , it works
Example:</p>
<pre><code>content: open-quote <span class="hljs-string">"*"</span>;
</code></pre><h5 id="heading-iii-afterafter">iii)  <strong>After(::after)</strong></h5>
<p> It's similar to before , with the difference of the placement i.e. it adds up styling/content .</p>
<p>Have you seen , busy depicted via red circle on initials/profile
Or green circle to depict Online ? It can be built using Pseudo-elements.</p>
<p>REAL-TIME Examples: Status on Discord , Notifications Count of Gmail can be built using ::after or ::before too. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668783168483/Av_i5iJwa.jpg" alt="After Pseudo Selector.jpg" /></p>
<pre><code>   span {
        <span class="hljs-attr">position</span>: relative;
        padding: <span class="hljs-number">10</span>px;
        border-radius: <span class="hljs-number">50</span>%;
        background-color: #b17ae7;
        color: #ffffff;
      }
<span class="hljs-comment">// Added red circle on beside the initials </span>
      <span class="hljs-attr">span</span>::after {
        <span class="hljs-attr">content</span>: <span class="hljs-string">""</span>;
        width: <span class="hljs-number">12</span>px;
        height: <span class="hljs-number">12</span>px;
        border-radius: <span class="hljs-number">50</span>%;
        background-color: red;
        display: block;
        position: absolute;
        right: <span class="hljs-number">-1</span>px;
        bottom: <span class="hljs-number">-1</span>px;
      }
</code></pre><h4 id="heading-why-afterbefore-and-some-other-pseudo-elements-also-work"><strong>WHY :AFTER/:BEFORE AND SOME OTHER PSEUDO ELEMENTS ALSO WORK?</strong></h4>
<p>As per CSS3 , a clear distinction has been made between pseudo elements and pseudo classes via <code>::</code> and <code>:</code> respectively on the basis of their core functionality which clearly wasn't there in previous versions and was a bit confusing.
So , as per the latest norms <code>::</code> is preferred and recommended to use , but due to browser compatibility to older versions :after/:before also works.</p>
<h4 id="heading-with-what-elements-does-after-andamp-before-doesnt-work"><strong>WITH WHAT ELEMENTS DOES ::AFTER &amp; ::BEFORE DOESN'T WORK?</strong></h4>
<p>The elements that do not have the content box where element's own content is placed i.e. replaced elements . Such as : <code>&lt;img&gt; , &lt;br&gt;, &lt;iframe&gt;</code> etc.</p>
<h4 id="heading-what-are-big-nos-while-using-pseudo-elements"><strong>WHAT ARE BIG NOS WHILE USING PSEUDO ELEMENTS?</strong></h4>
<p>a) Using pseudo elements in the middle of selectors or pseudo-classes.</p>
<p>Example :
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668791278186/Xh9Ukaevg.jpg" alt="Wrong Examples.jpg" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668792899878/4TT4TIm7C.jpg" alt="Correct Examples (1).jpg" /></p>
<p><em>The pseudo elements should be at the LAST to make it work.</em></p>
<p> b) Using multiple Pseudo Elements with a selector at one time .</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668793205508/EwOCU7R-u.jpg" alt="Correct Examples (2).jpg" /></p>
<p><em>If multiple pseudo elements are to be used on a single selector , it should be done separately</em></p>
<h4 id="heading-summary"><strong>SUMMARY</strong></h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668797734400/AXKCA_10k.jpg" alt="Untitled.jpg" /></p>
<p>Find all the code used in the article below:
https://github.com/Parul1999/CSS-Pseudo</p>
]]></content:encoded></item><item><title><![CDATA[CSS Selectors]]></title><description><![CDATA[What do you mean by Selectors in CSS ?*
Selectors tell the browser which HTML element(s) should be targeted🎯 so that those elements could be styled.
Styling any element is possible via Selectors ONLY.
There are manifold selectors , the ones which we...]]></description><link>https://blogs.parullkohhli.com/css-selectors</link><guid isPermaLink="true">https://blogs.parullkohhli.com/css-selectors</guid><category><![CDATA[combinators]]></category><category><![CDATA[iwritecode]]></category><category><![CDATA[selectors]]></category><category><![CDATA[CSS]]></category><category><![CDATA[styleguide]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Sat, 12 Nov 2022 22:48:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1668273231210/wWIC6Nz84.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668340348259/q_J64Z9lS.jpg" alt="Compound Selector (1).jpg" />
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668340293178/IbfZO9CeJ.jpg" alt="Compound Selector (1).jpg" />
<em>What do you mean by Selectors in CSS ?*</em></p>
<p>Selectors tell the browser which HTML element(s) should be targeted🎯 so that those elements could be styled.
Styling any element is possible via Selectors ONLY.</p>
<p>There are manifold selectors , the ones which we are going through are :</p>
<p><strong>What do you mean by Combinators in CSS ?</strong></p>
<p>The <em>kind of selectors</em> that combine or explains/build relationship between different types of selectors . </p>
<ul>
<li><strong>UNIVERSAL SELECTOR (*)</strong></li>
</ul>
<p>The styling written is applied to the entire web document. Lets try to understand with an example of Netflix.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668280201937/4I84t-wOW.png" alt="oHLdAz4e4.png" />
So , most of the font-colors and white and go to any page the background is black. 
Do you think for every element the developers would have written separate CSS?
Probably , not !!!
So , in such cases where in the entire website we have to give some common styling be it background , color, font-size etc. We mostly use Universal selector.</p>
<pre><code><span class="hljs-comment">//Syntax</span>
*{style properties}
<span class="hljs-comment">/*CSS to give white color to fonts and background as black
 in the site.*/</span>
*{
    background-color: #<span class="hljs-number">000000</span>;
    color: #FFFFFF
 }
<span class="hljs-comment">// #000000 - black and #FFFFFF - white</span>
</code></pre><ul>
<li><strong>TYPE SELECTOR</strong></li>
</ul>
<p>It means that the styling is applied to any and every element present.
Again , if I talk about Netflix , all the buttons are of red color.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668279433643/4a-2nOuQa.png" alt="image.png" />
So , in this kind of scenario when any type of element needs to be in specific manner or need to remove default styling to any kind of element , type selectors can be used.</p>
<pre><code><span class="hljs-comment">//Syntax</span>
element_name { style properties }
<span class="hljs-comment">/*all the button's present background goes red and
 font color goes white*/</span>
button{
background-color: #E20813;
color: #<span class="hljs-number">000000</span>
}
</code></pre><ul>
<li><strong>CLASS SELECTORS(.)</strong></li>
</ul>
<p>Various elements can have same class. The selector is used when same or different kind of element(s) need to have a similar kind of styling.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668283101687/KdLRPfn2S.jpg" alt="Class Selector.jpg" /></p>
<pre><code><span class="hljs-comment">//Syntax</span>
.class_name { style properties }
<span class="hljs-comment">/*all the elements having the class name of primary-color
 got the styling*/</span>
.primary-color{
  <span class="hljs-attr">color</span>:#<span class="hljs-number">0000</span>FF;
}
</code></pre><ul>
<li><strong>ID SELECTOR(#)</strong></li>
</ul>
<p>ID mean unique as we used to have roll-numbers in schools/colleges . So , ID selector needs to be unique. 
Now what does this mean? 
This means that the two HTML elements should not have same ID name , every HTML element which has the attribute of ID should have a different name. And then using ID selector , the element with the ID of same name gets the styling.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668284462256/Df5P2HFLs.jpg" alt="ID Selector.jpg" /></p>
<pre><code><span class="hljs-comment">//Syntax</span>
#element_name { style properties }
<span class="hljs-comment">//The element that has the id-name as list-item1 got the styling</span>
#list-item1{
   <span class="hljs-attr">padding</span>: <span class="hljs-number">10</span>px;
   background-color: #ffff00
}
</code></pre><ul>
<li><strong>COMPOUND SELECTOR</strong></li>
</ul>
<p>You can refer to them as chaining/and selector because this is what it does i.e. chain different selectors(as we have read so far) without any space.
Let's try to understand what different chaining mean with the help of examples.</p>
<pre><code><span class="hljs-comment">//Example1</span>
p.primary#txt1{
 <span class="hljs-attr">border</span>: <span class="hljs-number">5</span>px solid #<span class="hljs-number">000000</span>;
 color:#ad01ad;
}
<span class="hljs-comment">/* This means a p tag which has a class "primary "
AND also has an id of "txt1" will get the styling 
*/</span>

<span class="hljs-comment">//Example2</span>
input.btn.primary{
 background-color: #<span class="hljs-number">6495</span>ed;
 border: <span class="hljs-number">5</span>px solid #ffff00;
 color: #ffffff;
}
<span class="hljs-comment">/* This means an input tag which has a class "btn"
AND also has a class of "primary" will get the styling 
*/</span>
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668340362890/XUgr4kn5X.jpg" alt="Compound Selector (1).jpg" />
NOTE: No space among the selectors.</p>
<ul>
<li><strong>SELECTOR LIST/COMBINED SELECTOR(,)</strong></li>
</ul>
<p>It is used when same CSS is applied to different kind of elements via tag/class or id selectors.
All the selectors separated by comma(,) gets the styling.
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668288088158/u4Xjc7t9j.jpg" alt="Selector List.jpg" /></p>
<pre><code><span class="hljs-comment">// Syntax: selector1 , selector2 {}</span>
<span class="hljs-comment">/* All the span element , the element with the id of 
"list-item1" and the elements with the class name of
 "para" got the styling */</span>
span,
#list-item1,
.para {
  background-color: #ffff00;
  padding: <span class="hljs-number">10</span>px;
  color: #ff0000;
}
</code></pre><ul>
<li><strong>DESCENDANT COMBINTOR( )</strong>
The whitespace( ) between the selectors represent descendant combinator(inside an element).
Let's throw some light on it with the aid of an example</li>
</ul>
<pre><code><span class="hljs-comment">//Syntax: selector1 selector2{}</span>
 div li {
  <span class="hljs-attr">color</span>: #ff0000;
 }
<span class="hljs-comment">/*This means any "li" present inside the div AT ANY LEVEL ,
 be it direct child, grand-child, great-grand child 
and so on will get the styling.
*/</span>
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668289680429/opq2OPzSx.jpg" alt="Descendant Selector.jpg" />
NOTE : Space between the selectors is a must.</p>
<ul>
<li><strong>CHILD COMBINATOR(&gt;)</strong></li>
</ul>
<p>The only difference between descendant and child combinator is that the CSS will only apply to the direct child of the parent and NOT on all children at any level.</p>
<pre><code><span class="hljs-comment">//Syntax: selector1 &gt; selector2{}</span>
 div &gt; li {
  <span class="hljs-attr">color</span>: #ff0000;
 }
<span class="hljs-comment">/* This means any "li" present in the div 
as a DIRECT CHILD gets the styling.*/</span>
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668290224826/bIyTiFoEo.jpg" alt="Child Selector (1).jpg" /></p>
<ul>
<li><strong>ADJACENT SIBLING COMBINATOR(+)</strong></li>
</ul>
<p>As adjacent mean <em>next to something</em>  , similarly adjacent sibling combinator mean the styling would go to the <strong><em>immediate next sibling</em></strong></p>
<pre><code><span class="hljs-comment">//Syntax: former_element + target_element { style properties }</span>
 .list-item2 + li {
   <span class="hljs-attr">color</span>: #ff0000;
   font-style: italic;
}
<span class="hljs-comment">/*This means the styling goes to IMMEDIATE NEXT SIBLING of the element
which has the class of list-item2*/</span>
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668291097303/pUMJgLhY_.jpg" alt="Adjacent Sibling Selector.jpg" /></p>
<p>NOTE: Had there been NO IMMEDIATE target element the CSS would'nt apply</p>
<ul>
<li><strong>GENERAL SIBLING COMBINATOR(~)</strong>
The styling applies to all the siblings immediate or not that are next to the former_element and satisfy the condition after (~). In our example the condition is the class should be "amazing".<pre><code><span class="hljs-comment">//Syntax: former_element ~ target_element { style properties }</span>
.list-item2 ~ .amazing {
<span class="hljs-attr">color</span>: #ff0000;
font-style: italic;
}
<span class="hljs-comment">/*This means the styling goes to ALL the NEXT SIBLING(s) 
which has the class of "amazing" of the element 
( class="list-item2"). 
It isn't necessary whether the elements are immediate 
or not*/</span>
</code></pre><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668291515816/9Cn1bvTsK.jpg" alt="General Sibling Selector.jpg" /></li>
</ul>
<p><strong>SUMMARY</strong>
To summarize the selectors and combinators covered in the article are : 
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1668293150675/AyI-2Nksd.png" alt="CSS Selectors (2).png" />
Different selectors(also combinators that are type of selectors) and different ways can be used to achieve the same output . The situation and the code in hand should decide your best way to approach towards the output needed.</p>
<p>Here you can download all the code files used in the article:
https://github.com/Parul1999/CSS-Selectors/</p>
]]></content:encoded></item><item><title><![CDATA[Transpiling V/s Compiling]]></title><description><![CDATA[The blog is all about transpiler and compiler and their process. It also includes the advantages and the types along with examples for better understanding.
TRANSPILING
What is a transpiler?
Transpilers, are tools that read the source code written in...]]></description><link>https://blogs.parullkohhli.com/transpiling-vs-compiling</link><guid isPermaLink="true">https://blogs.parullkohhli.com/transpiling-vs-compiling</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[compiler]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Mon, 10 Jan 2022 12:59:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1641816929201/wlXtd2uOJn.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The blog is all about transpiler and compiler and their process. It also includes the advantages and the types along with examples for better understanding.</p>
<h2 id="heading-transpiling">TRANSPILING</h2>
<p><strong>What is a transpiler?</strong>
Transpilers, are tools that read the source code written in one language and produce the equivalent code in another language with a similar level of abstraction. It is also known as <em>source-to-source compilers</em>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1641817175865/7_MWNCokQ.png" alt="image.png" /></p>
<p><strong>How transpiler works?</strong>
Transpiling is the type of compilation. It switches one language (or version of a language) to another at the same number(abstraction level). </p>
<p>Abstraction - It refers to the important things that are visible to the user and all the working which is irrelevant to the user is hidden. </p>
<p>The lower the number the lower is the abstraction level.</p>
<ol>
<li>CPU-level (actual logic gates on the CPU)</li>
<li>machine code</li>
<li>assembly code</li>
<li>[C/C++, JVM/bytecode]</li>
<li>[JavaScript, Python]</li>
</ol>
<p><strong>What is transpiling? </strong>
Transpiling is the process in which the transpilers convert the source code from one language/version of the language to another language/version at the same abstraction level.</p>
<p><strong>Types of transpiler</strong>
There are different types of transpilers, as per the source and target language.</p>
<p>E.g <em>Babel</em> transpiler is the most popular and commonly used for converting the ES6 JS code to ES5 JS source code or any lower version.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1641818749353/y00kVLcd0.png" alt="image.png" /></p>
<p><strong>Advantages of transpilers</strong>
Transpiler's goal is that programmers do not need to rewrite or duplicate code anymore. When a new language or library comes up, programmers should be able to use and tune transpilers so legacy code does not turn out to be obsolete.</p>
<p>Also, taking the example of JS. The browser compatibility to the code comes into the picture. As of today, most of the browsers are compatible with ES5 and not with ES6 yet as to make a browser compatible with the new language/syntax there is a long process by when we may expect a new language/version</p>
<p>So, it's not as important as a compiler but has its own uses and advantages.</p>
<h2 id="heading-compiling">COMPILING</h2>
<p><strong>What is a compiler?</strong>
A compiler is a program that processes statements written in a particular language and turns them into machine language or "code".</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1641812434424/P64KBbfdB.png" alt="image.png" /></p>
<p>Machine code is the binary code i.e written in 0s and 1s and understood by the machine and hence known as machine code.</p>
<p><strong>Types of compilers</strong>
There are multiple compilers used for different purposes.
The common ones are:</p>
<ul>
<li><p>ahead-of-time (AOT) compilers: These are typically invoked from the command line in a shell environment (from within a terminal or console) or within an IDE.</p>
</li>
<li><p>just-in-time (JIT) compilers: These are typically not invoked directly but are instead built into software runtimes internally, for the purpose of improving performance.</p>
</li>
</ul>
<p><strong>How compiler works?</strong>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1641812145191/d0PoFswMC.png" alt="image.png" />
The compiler takes the code and converts it into machine code as per the definition and the output is received.</p>
<p>Most compilers perform either ahead-of-time (AOT) compilation or just-in-time (JIT) compilation.</p>
<p><strong>What is compiling? </strong>
The process of converting a high-level code(javascript/typescript) written in any language to a low-level code/machine code is known as compilation/ compiling.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1641815550226/GRPJUS2QZ.png" alt="image.png" /></p>
<p><strong>Advantages of compiling
</strong>
The machine won't understand a thing if the code is not compiled. So to perform any and every operation on the machine, the compilation of code is a must which leaves us with no cons.</p>
<p><strong>SUMMARY</strong>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1641819042313/kUz391JGQ.png" alt="image.png" /></p>
]]></content:encoded></item><item><title><![CDATA[Concepts and Terms in HTML and CSS]]></title><description><![CDATA[Semantic and Non-Semantic Tags

Semantic Tags are the tags that have a meaning in themselves and tell us about the content inside the tags. 
E.g form, header tags

Non-Semantic Tags are the tags that do not tell about the content written inside them....]]></description><link>https://blogs.parullkohhli.com/concepts-and-terms-in-html-and-css</link><guid isPermaLink="true">https://blogs.parullkohhli.com/concepts-and-terms-in-html-and-css</guid><category><![CDATA[HTML5]]></category><category><![CDATA[CSS]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Sat, 18 Sep 2021 23:14:55 GMT</pubDate><content:encoded><![CDATA[<p><strong> Semantic and Non-Semantic Tags</strong></p>
<ul>
<li><p>Semantic Tags are the tags that have a meaning in themselves and tell us about the content inside the tags. 
E.g form, header tags</p>
</li>
<li><p>Non-Semantic Tags are the tags that do not tell about the content written inside them.
E.g div, span tags</p>
</li>
</ul>
<p>It's important to use semantic tags wherever possible to make people understand the website better who uses screen readers for using the website.</p>
<p><strong>Tag vs. Element</strong>
The tag doesn't include the contents written b/w tags. 
Element means the starting and closing tags including the content written between them</p>
<pre><code><span class="hljs-comment">// Tag </span>
&lt;button&gt;

<span class="hljs-comment">//Element</span>
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span>
</code></pre><p><strong>Types of Elements</strong></p>
<ul>
<li><p>BLOCK ELEMENT -&gt; It uses the entire row i.e it stretches from the extreme left end of the screen to the right one. For this reason itself, it always starts from a new line. Mainly it has some top and bottom margins. 
E.g div, p tags.</p>
</li>
<li><p>INLINE ELEMENT -&gt;An inline element does not start on a new line and takes up as much width as necessary. It does not have some top and bottom margins too. 
E.g span, button tag</p>
</li>
</ul>
<p><strong> CSS Selectors </strong></p>
<p>In simple words, CSS Selectors means the ways to select HTML elements to put CSS on them. There are various selectors, but mainly there are 3 types of selectors which are as follows:-</p>
<ol>
<li><p>ID - a selection made on the basis of ID . E.g In real life the ID can be a roll number. It is unique, right? So does is the ID in HTML. It is represented by #(hash) .</p>
</li>
<li><p>Class - A class can have n number of pupils and so does in HTML, n number of elements can have the same class name. It is represented by a .(dot) .</p>
</li>
<li><p>Tag Name - A CSS can be applied to all the tag names present in a file directly.</p>
</li>
</ol>
<pre><code><span class="hljs-selector-tag">E</span><span class="hljs-selector-class">.g</span>
<span class="hljs-selector-tag">button</span>
{
<span class="hljs-attribute">border</span>:none;
}

<span class="hljs-selector-tag">It</span> <span class="hljs-selector-tag">will</span> <span class="hljs-selector-tag">make</span> <span class="hljs-selector-tag">the</span> <span class="hljs-selector-tag">border</span>: <span class="hljs-selector-tag">none</span> <span class="hljs-selector-tag">of</span> <span class="hljs-selector-tag">all</span> <span class="hljs-selector-tag">the</span> <span class="hljs-selector-tag">buttons</span> <span class="hljs-selector-tag">present</span> <span class="hljs-selector-tag">in</span> <span class="hljs-selector-tag">the</span> <span class="hljs-selector-tag">HTML</span> <span class="hljs-selector-tag">file</span>.
</code></pre><p><strong>Variables in CSS </strong>
It's a way to write once and use it everywhere in CSS. 
E.g</p>
<pre><code><span class="hljs-selector-pseudo">:root</span>
{
<span class="hljs-attribute">--primary-color</span>:red;
}

<span class="hljs-selector-tag">Now</span> <span class="hljs-selector-tag">any</span> <span class="hljs-selector-tag">element</span> <span class="hljs-selector-tag">that</span> <span class="hljs-selector-tag">needs</span> <span class="hljs-selector-tag">color</span> <span class="hljs-selector-tag">red</span> <span class="hljs-selector-tag">can</span> <span class="hljs-selector-tag">use</span> <span class="hljs-selector-tag">it</span> <span class="hljs-selector-tag">as</span> :

<span class="hljs-selector-tag">div</span>
{
<span class="hljs-attribute">color</span>:<span class="hljs-built_in">var</span>(--primary-color);
}
<span class="hljs-selector-tag">button</span>
{
<span class="hljs-attribute">border-color</span>: <span class="hljs-built_in">var</span>(--primary-color);
}
</code></pre><p>The major use of variables in CSS is that it reduces the number of conditions that are supposed to be written in code on which a different color pops up.</p>
]]></content:encoded></item><item><title><![CDATA[Markdown Files]]></title><description><![CDATA[.md file is known as a Markdown file. It's a file that simply converts a simple text to an HTML file.
Some basic syntax :
HEADING: 
# Heading 1   => <h1> </h1>
## Heading 2 => <h2></h2>
.
.
.
###### Heading 6 => <h6></h6>

// # heading 1 - Correct 
/...]]></description><link>https://blogs.parullkohhli.com/markdown-files</link><guid isPermaLink="true">https://blogs.parullkohhli.com/markdown-files</guid><category><![CDATA[markdown]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Sat, 07 Aug 2021 17:37:40 GMT</pubDate><content:encoded><![CDATA[<p>.md file is known as a Markdown file. It's a file that simply converts a simple text to an HTML file.</p>
<p>Some basic syntax :</p>
<p><strong>HEADING: </strong></p>
<pre><code># Heading 1   =&gt; <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span> <span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
## Heading 2 =&gt; <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
.
.
.
###### Heading 6 =&gt; <span class="hljs-tag">&lt;<span class="hljs-name">h6</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">h6</span>&gt;</span>

// # heading 1 - Correct 
// #heading 1 - Incorrect
</code></pre><p><strong>List: </strong> </p>
<pre><code><span class="hljs-string">Unorder</span> <span class="hljs-string">List</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">First</span> <span class="hljs-string">Item</span> <span class="hljs-string">or</span> <span class="hljs-string">*</span> <span class="hljs-string">First</span> <span class="hljs-string">Item</span> <span class="hljs-string">or</span> <span class="hljs-string">+</span> <span class="hljs-string">First</span> <span class="hljs-string">Item</span>

<span class="hljs-string">Ordered</span> <span class="hljs-string">List</span> 
<span class="hljs-number">1</span><span class="hljs-string">.</span> <span class="hljs-string">First</span> <span class="hljs-string">Item</span> 
<span class="hljs-number">1</span><span class="hljs-string">.</span> <span class="hljs-string">Second</span> <span class="hljs-string">Item</span>

<span class="hljs-string">=&gt;</span> <span class="hljs-string">(Equivalent</span> <span class="hljs-string">To)</span>

<span class="hljs-number">1</span><span class="hljs-string">.</span> <span class="hljs-string">First</span> <span class="hljs-string">Item</span>
<span class="hljs-number">2</span><span class="hljs-string">.</span> <span class="hljs-string">Second</span> <span class="hljs-string">Item</span>
</code></pre><p><strong>Code: </strong> The box is similar to the above one, 3 backticks(`) in the start and 3 at the end.</p>
<p><strong>Bold: </strong></p>
<pre><code><span class="hljs-strong">** Bold **</span>
<span class="hljs-strong">__ Bold __</span>
</code></pre><p><strong>Italic: </strong></p>
<pre><code><span class="hljs-emphasis">*Italic*</span>
<span class="hljs-emphasis">_Italic_</span>
</code></pre><p><strong>Italic and Bold: </strong></p>
<pre><code><span class="hljs-strong">**<span class="hljs-emphasis">*ItalicandBold<span class="hljs-strong">**<span class="hljs-emphasis">*
<span class="hljs-strong">__<span class="hljs-emphasis">_ItalicandBold<span class="hljs-strong">__<span class="hljs-emphasis">_
<span class="hljs-strong">__<span class="hljs-emphasis">*ItalicandBold*</span>__</span>
<span class="hljs-strong">**<span class="hljs-emphasis">_ItalicandBold_</span>**</span></span></span></span></span></span></span></span></span>
</code></pre><p><strong>Horizontal Line: </strong></p>
<pre><code>*** <span class="hljs-keyword">or</span> <span class="hljs-comment">---</span>
</code></pre><p><strong>Link: </strong></p>
<pre><code>[<span class="hljs-string">Text</span>](<span class="hljs-link">Link</span>)
</code></pre><p>Markdown can be used for everything. Markdown is platform-independent. People use it to create websites, documents, notes, books, presentations, email messages, and technical documentation.
This was the basic syntax that was required for you to know and to write in the .md file. Now you are good to go.</p>
]]></content:encoded></item><item><title><![CDATA[Git and Github]]></title><description><![CDATA[Github is like your class teacher, git is like your subject teacher and you being the code/record/file.
So, as it goes in the school hierarchy the same goes for git, GitHub, and code.
GIT:  As your teacher keeps your record, git keeps the record of y...]]></description><link>https://blogs.parullkohhli.com/git-and-github</link><guid isPermaLink="true">https://blogs.parullkohhli.com/git-and-github</guid><category><![CDATA[GitHub]]></category><category><![CDATA[Git]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Sat, 07 Aug 2021 17:25:02 GMT</pubDate><content:encoded><![CDATA[<p>Github is like your class teacher, git is like your subject teacher and you being the code/record/file.</p>
<p>So, as it goes in the school hierarchy the same goes for git, GitHub, and code.</p>
<p><strong>GIT: </strong> As your teacher keeps your record, git keeps the record of your code or file. 
As if the student improves or does anything teacher has the record. Similarly, the git keeps all the records of the addition/updation or deletion in the code/file.</p>
<p><strong>GITHUB: </strong> Now, every subject teacher has a separate record for the students which is relevant to their subject and is given to the class teacher. Now the class teacher has the record of everybody about everything. Anybody can go to her and ask about anyone anything. Now, Github is exactly similar. 
I have some code, pushed to Github, anyone can come to see my code or even make his/her own changes with permission(that's a separate topic though).</p>
<p>Now a teacher has a memory and a file in which she can jot down the information.
What does git has?</p>
<p>Let's introduce a new term, </p>
<p><strong>Commit</strong> - It's like your signature corresponding to your work. The commit has two parts,
1) Commit Message - It is typed by you, i.e a message 
2) Commit Id - It's given by the git automatically as you make a commit, which is unique.</p>
<p><strong>There are some standards while writing the commit message. They are as follows:</strong>
Add the following words at the beginning of the message.</p>
<ol>
<li>Feat - New Feature. E.g Feat - added a new level.</li>
<li>Fix - For a fix.</li>
<li>Docs - For changes made in docs.</li>
<li>Style - Everything related to styling.</li>
<li>Refactor - Code changes that neither change O/P nor Functionality.</li>
<li>Test - Everything related to testing.</li>
<li>Chore - Updating build task, package manager config.</li>
</ol>
<p>The first time, when you push the code to GITHUB, a file called README.md is created. What is it and what does a .md file contains, if you want to read about it.
<a target="_blank" href="https://dailyblogs.hashnode.dev/markdown-files">Click Here </a> .</p>
<p><strong>Repository: </strong> Okay, I have been using the word file/code/record for so long now. In Github, the file which has the project/file is known as Repository.</p>
<p><strong>Branch: </strong> It's like every person has a separate room in the house. But, any person who comes to meet sits and has a conversation in the drawing-room. Similarly, a branch is like having a separate space work for every person/every feature. Any client/user that comes to the browser/your site just sees whatever code is there in the main branch. 
The main branch is the branch where everybody's code is merged and reflected on the site.
A single person can also work on different branches for implementing versions to the site. 
E.g There is the main branch that reflects version 1.0 of your site. Now, you want to make a version 2.0, so to track the changes you make a branch from the main branch, and the users/clients would see only when version 2.0 is complete and merged to the main branch.</p>
<p><strong>Pull Request(PR): </strong>  PR comes handy when there are multiple people working on a project on multiple branches. So, when a person completes a functionality, to push it to the main branch that is reflected on the main site, a PR is raised to which the manager/co-workers review it, add comments, and then if it seems all correct then merged(added) to the main branch. </p>
]]></content:encoded></item><item><title><![CDATA[Basic Terms Before Starting Programming]]></title><description><![CDATA[Let's walk through some of the terms used widely in a programming language : 

Object - It's used to store different values in the form of key and value pairs.

// Syntax 

var obj ={
key : value
}

// If a box has different colors of balls, their nu...]]></description><link>https://blogs.parullkohhli.com/basic-terms-before-starting-programming</link><guid isPermaLink="true">https://blogs.parullkohhli.com/basic-terms-before-starting-programming</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[General Programming]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Sun, 01 Aug 2021 14:21:45 GMT</pubDate><content:encoded><![CDATA[<p>Let's walk through some of the terms used widely in a programming language : </p>
<blockquote>
<p><strong>Object</strong> - It's used to store different values in the form of key and value pairs.</p>
</blockquote>
<pre><code><span class="hljs-comment">// Syntax </span>

<span class="hljs-keyword">var</span> obj ={
key : <span class="hljs-keyword">value</span>
}

<span class="hljs-comment">// If a box has different colors of balls, their number will be represented in the form of an object as follows :</span>

<span class="hljs-keyword">var</span> listOfBalls ={
green : <span class="hljs-number">22</span>,
red : <span class="hljs-number">10</span>
}
</code></pre><blockquote>
<p><strong>Comment</strong> - It is similar to the person who exists but not for you. Similarly, a comment is something that is written but the programming language doesn't consider it. You can comment in the following ways :</p>
</blockquote>
<p><code>// This is a comment.</code></p>
<p><code>/* This is one another comment. */</code></p>
<blockquote>
<p><strong>Variable</strong> - Do you have a name? Of course, everybody has one. What is its use? It is used to specifically call you. Right? 
Similarly, anything that possesses data is given a name so that whenever it's required, it can be called/used via its name.
It's always written on the right-hand side.</p>
</blockquote>
<pre><code><span class="hljs-keyword">var</span> <span class="hljs-built_in">number</span> = <span class="hljs-number">1</span>; <span class="hljs-comment">//number is a variable.</span>
<span class="hljs-keyword">var</span> name  = <span class="hljs-string">"CLI App"</span> <span class="hljs-comment">//var is used in JS</span>
</code></pre><blockquote>
<p><strong>Function</strong> -  If I compare it with one of the daily life objects i.e Washing Machine, i.e new clothes are sent inside it, but it performs the same operation of cleaning them.
Here,</p>
<ol>
<li>Input is dirty clothes </li>
<li>Processing is what happens inside the machine </li>
<li>Output is clean clothes</li>
</ol>
<p>In a programming language, a function is similar to the washing machine, in which new data is sent, but the same operation is performed, no matter what. 
Here,</p>
<ol>
<li>Input - Data sent</li>
<li>Processing - Operation Performed</li>
<li>Output - The data received after operation
sumNumbers is the Function Name.</li>
</ol>
<p>number1 and number2 are parameters. There can be <em>n</em> number of parameters.</p>
<p>62, 89 are the arguments that are passed to the function.</p>
</blockquote>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sumNumbers</span>(<span class="hljs-params">number1, number2</span>)
</span>{
   <span class="hljs-keyword">var</span> sum = <span class="hljs-built_in">number</span> <span class="hljs-number">1</span> + <span class="hljs-built_in">number</span> <span class="hljs-number">2</span>;
}

<span class="hljs-keyword">var</span> result = sumNumbers(<span class="hljs-number">62</span>,<span class="hljs-number">89</span>);
</code></pre><blockquote>
<p><strong>Array</strong> - It is to store some things together.  The first element is at position '0'.</p>
</blockquote>
<pre><code>var colorArray = ["Red", "Black","Blue"];
//<span class="hljs-keyword">to</span> <span class="hljs-keyword">access</span> the <span class="hljs-keyword">values</span> <span class="hljs-keyword">of</span> the <span class="hljs-keyword">array</span>
colorArray[<span class="hljs-number">0</span>] = Red;
colorArray[<span class="hljs-number">1</span>] = Black;
colorArray[<span class="hljs-number">2</span>] = Blue;
</code></pre><blockquote>
<p><strong>For Loop</strong> - It's similar to getting up daily on every single day of your life until the last day of your life. That is you are doing the same thing in a loop. If I had to write this in the format of a code, it would have been as :</p>
</blockquote>
<pre><code><span class="hljs-keyword">for</span>(var i = The day you were born ; i&lt;=day you will die;i=i+<span class="hljs-number">1</span>)
{
//getting up
}

Which <span class="hljs-keyword">is</span> equivalent <span class="hljs-keyword">to</span> :

<span class="hljs-keyword">for</span>(var i = <span class="hljs-number">1</span>; i&lt;=n;i=i+<span class="hljs-number">1</span>)
{
//<span class="hljs-keyword">perform</span> a specific operation
}
</code></pre><blockquote>
<p><strong>Conditional Statements</strong> -  It's similar to thinking of all the cases that are to be handled if we go late at home. If mom will ask xyz then I will say abc else I will say deb. In code , it will be written as : </p>
</blockquote>
<pre><code><span class="hljs-keyword">var</span> <span class="hljs-built_in">num</span> = <span class="hljs-number">0</span>;
<span class="hljs-keyword">if</span>(<span class="hljs-built_in">num</span>==<span class="hljs-number">0</span>)<span class="hljs-comment">//condition</span>
{
console.log(<span class="hljs-string">"Number is 0"</span>);
}
<span class="hljs-keyword">else</span>
{
console.log(<span class="hljs-string">"Number is not 0"</span>);
}
</code></pre><pre><code><span class="hljs-keyword">var</span> <span class="hljs-built_in">num</span> = <span class="hljs-number">5</span>;
<span class="hljs-keyword">if</span>(<span class="hljs-built_in">num</span>&gt;<span class="hljs-number">0</span>)<span class="hljs-comment">//condition</span>
{
console.log(<span class="hljs-string">"Number is positive"</span>);
}
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span>(<span class="hljs-built_in">num</span>&lt;<span class="hljs-number">0</span>)
{
console.log(<span class="hljs-string">"Number is negative"</span>);
}
<span class="hljs-keyword">else</span>
{
console.log(<span class="hljs-string">"Number is 0"</span>);
}
</code></pre><p><strong>NOTE -  EVERYTHING IN JAVASCRIPT IS AN OBJECT, AND ALL THE KEYS BECOME PROPERTY OF THE OBJECT.</strong></p>
]]></content:encoded></item><item><title><![CDATA[All You Need For The First CLI App]]></title><description><![CDATA[What is a CLI?
CLI stands for COMMAND LINE INTERFACE . As the name suggests, it is used for interacting using some commands. Simply, it is a way of interaction with the user and browser without any graphics i.e majorly in plain text 

Anything you do...]]></description><link>https://blogs.parullkohhli.com/all-you-need-for-the-first-cli-app</link><guid isPermaLink="true">https://blogs.parullkohhli.com/all-you-need-for-the-first-cli-app</guid><category><![CDATA[Beginner Developers]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[cli]]></category><dc:creator><![CDATA[Parull Kohhli]]></dc:creator><pubDate>Sun, 01 Aug 2021 13:24:58 GMT</pubDate><content:encoded><![CDATA[<blockquote>
<p>What is a CLI?</p>
<p>CLI stands for <strong>COMMAND LINE INTERFACE</strong> . As the name suggests, it is used for interacting using some commands. Simply, it is a way of interaction with the user and browser without any graphics i.e majorly in plain text </p>
</blockquote>
<p>Anything you do consists of mainly three things : </p>
<ul>
<li>Input</li>
<li>Processing</li>
<li>Output</li>
</ul>
<p>The same you need to remember while building your FIRST CLI APP.</p>
<p>Before we jump to code, go check out the  <a target="_blank" href="https://dailyblogs.hashnode.dev/basic-terms-before-starting-programming">Basic Terminology</a>  that would be used.</p>
<p>LET'S BEGIN , BY MAKING A DO YOU KNOW ME QUIZ !!!!</p>
<p>Let's make the app on the online IDE . I am using REPL.it .
Make your account and create a new REPL(language Node.js / javascript).</p>
<p>As we learned three things are a must , 
INPUT , PROCESSING AND OUTPUT .</p>
<p>For INPUT , we will be using <a target="_blank" href="https://www.npmjs.com/package/readline-sync">readline-sync</a>  and for making our CLI app a little colorful we will be using <a target="_blank" href="https://www.npmjs.com/package/chalk">chalk</a> .</p>
<p>In case , if you are not using REPL.IT or any other online IDE , begin with Step 1 . Rest can start with Step 2 as online IDE will automatically install the packages as you use them</p>
<p><strong>Step 1 :</strong> To Install the packages :-         </p>
<ul>
<li>npm install readline-sync</li>
<li>npm install chalk </li>
</ul>
<p><strong>Step 2 : </strong> To tell your app that we need the packages and we are going to use them .</p>
<pre><code><span class="hljs-keyword">const</span> readLineSync = <span class="hljs-keyword">require</span>(<span class="hljs-string">'readline-sync'</span>);
<span class="hljs-keyword">const</span> chalk = <span class="hljs-keyword">require</span>(<span class="hljs-string">'chalk'</span>);
</code></pre><p><strong>Step 3 :</strong> Now we need to know the person's name who is playing the game , because w address people with their names.</p>
<pre><code><span class="hljs-keyword">const</span> userName = readLineSync.question(
                                 chalk.cyanBright(<span class="hljs-string">"What's your good name?"</span>)
                                 );
<span class="hljs-comment">// chalk.cyanBright represents the color in which it will be visible.</span>
</code></pre><p><strong>Step 4 :</strong> We need an array to store all the questions and their correct answers. I am using one of the types in <a target="_blank" href="https://www.npmjs.com/package/readline-sync">readline-sync</a> i.e the user can I/P answer only in a yes(y) or no(n). You can choose whatever you would like to , as per your choice from the docs.</p>
<p>Also initialise the score to 0;</p>
<pre><code><span class="hljs-keyword">var</span> score = <span class="hljs-number">0</span>;
<span class="hljs-keyword">var</span> questionListOne =[{
question:<span class="hljs-string">"She lives in Delhi."</span>,
answer:<span class="hljs-literal">false</span>
},
{
question:<span class="hljs-string">"She has a younger brother."</span>,
answer:<span class="hljs-literal">true</span>
},
{
question:<span class="hljs-string">"She has watched 'FRIENDS'."</span>,
answer:<span class="hljs-literal">false</span>
},
{question:<span class="hljs-string">"She loves Pizza over Burger."</span>,
answer:<span class="hljs-literal">true</span>},
{
question:<span class="hljs-string">"She does'nt know cooking,"</span>,
answer:<span class="hljs-literal">true</span>
}
]
</code></pre><p><strong>Step 5 : </strong> Now I need to map the questions , so I will be needing a for-loop. But in the loop I need to check whether the answer matches to what user has input , if it does , increase the score by 1 , and if it does'nt decrease the score by 1 or make no changes in the score.</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">checkAns</span>(<span class="hljs-params">ques,correctAns</span>)
</span>{
  <span class="hljs-keyword">var</span> userAns = readLineSync.keyInYNStrict(chalk.bold.yellowBright(ques));
  <span class="hljs-keyword">if</span>(userAns == correctAns)
  {
    <span class="hljs-built_in">console</span>.log(chalk.greenBright(userName +<span class="hljs-string">" , Correct Answer"</span>));
    score = score + <span class="hljs-number">1</span>;
     <span class="hljs-built_in">console</span>.log(chalk.greenBright(<span class="hljs-string">"Score = "</span>+ score));
  }
  <span class="hljs-keyword">else</span>
  {
    <span class="hljs-built_in">console</span>.log(chalk.redBright(userName +<span class="hljs-string">" , Wrong Answer score remains same"</span>));
  }
}
</code></pre><pre><code><span class="hljs-keyword">for</span>(<span class="hljs-keyword">var</span> i =<span class="hljs-number">0</span>;i&lt;questionListOne.length;i++)
{
  currQues =questionListOne[i]
  <span class="hljs-built_in">console</span>.log(); <span class="hljs-comment">// to give a empty line</span>
  checkAns(currQues.question,currQues.answer)
}
</code></pre><p><strong>Step 6</strong> :  Now comes the final step , that is to show the user his/her final score.</p>
<pre><code>console.log(chalk.bgYellow("\nTHE QUIZ ENDED !! FINAL SCORE IS :" + score + " "));
</code></pre><p><strong>## HERE YOU GO , YOUR FIRST CLI APP IS COMPLETE </strong></p>
<p>If you still find any difficulty or want to checkout my version of "DO YOU KNOW ME".
Checkout the link ( <a target="_blank" href="https://replit.com/@ParulKohli/Level0-Assignment-1?embed=1&amp;output=1">Click Here </a> ) and make your version of it .</p>
<p><strong>CHALLENGE : ADD LEVELS TO YOUR CLI APP .
IF THE PERSON SCORES SUPPOSE 50% OR MORE THEN ONLY ALLOW HIM TO PLAY IN THE NEXT LEVEL . 
</strong></p>
]]></content:encoded></item></channel></rss>