<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Priti Jha on Medium]]></title>
        <description><![CDATA[Stories by Priti Jha on Medium]]></description>
        <link>https://medium.com/@jhapriti09?source=rss-c3f1085ef802------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EWLiE7qyhM0ovV6yKePqig.jpeg</url>
            <title>Stories by Priti Jha on Medium</title>
            <link>https://medium.com/@jhapriti09?source=rss-c3f1085ef802------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 07:56:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jhapriti09/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ Real-World Frontend Problem Every Developer Faces]]></title>
            <link>https://jhapriti09.medium.com/real-world-frontend-problem-every-developer-faces-dae6a6ea7dfa?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/dae6a6ea7dfa</guid>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Fri, 24 Apr 2026 04:54:32 GMT</pubDate>
            <atom:updated>2026-04-24T04:54:32.443Z</atom:updated>
            <content:encoded><![CDATA[<p>🚨 Real-World Frontend Problem Every Developer Faces</p><p>Scenario:<br>A user clicks the Submit button multiple times… and boom 💥<br>👉 Duplicate orders are created.</p><p>This is not just a UI issue — it’s a system design problem.</p><p>💡 How I Handle This (Production Approach)</p><p>✅ 1. Frontend Protection (Angular)</p><p>Disable button after first click</p><p>Track request state (isSubmitting)</p><p>Show loader to improve UX</p><p>👉 Prevents accidental multiple clicks</p><p>⚡ 2. RxJS Smart Handling</p><p>Use exhaustMap to ignore repeated clicks while request is in progress</p><p>✔ Ensures only one API call at a time</p><p>🔐 3. Backend Safety (Most Important)</p><p>Even if frontend fails, backend should NOT create duplicates</p><p>Use Idempotency Key</p><p>Same request → same result</p><p>No duplicate database entries</p><p>🧠 Key Learning</p><p>“Never rely only on frontend validation. Always design backend systems to be safe against duplicate requests.”</p><p>🚀 Final Thought</p><p>Robust applications are not built by just writing code —<br>they’re built by anticipating real user behavior.</p><p>💬 How do you handle duplicate submissions in your projects?<br>Would love to hear different approaches!</p><p>#Angular #Frontend #SystemDesign #WebDevelopment #JavaScript #InterviewPrep</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dae6a6ea7dfa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Mastering RxJS: Understanding Different Types of Operators in Reactive Programming]]></title>
            <link>https://jhapriti09.medium.com/mastering-rxjs-understanding-different-types-of-operators-in-reactive-programming-edbfde0895f7?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/edbfde0895f7</guid>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Fri, 13 Jun 2025 07:12:15 GMT</pubDate>
            <atom:updated>2025-06-13T07:12:15.348Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_pmR7WYmptueXmoISY6lw.png" /></figure><p>In the modern frontend ecosystem, <strong>RxJS (Reactive Extensions for JavaScript)</strong> plays a vital role in handling asynchronous data streams, especially in Angular applications. One of the key concepts to truly harness the power of RxJS lies in understanding its <strong>operators</strong> — the building blocks that transform, combine, filter, and manage streams of data.</p><p>In this article, I’ll break down the <strong>main categories of RxJS operators</strong>, with real-world context on when and how to use them effectively.</p><h3>🔄 1. Creation Operators</h3><p>These operators are used to <strong>create observables</strong> from scratch or from various data sources like events, timers, arrays, and more.</p><p><strong>Examples:</strong></p><ul><li>of() – Emits the arguments you provide.</li><li>from() – Converts arrays, promises, or iterables into observables.</li><li>interval() – Emits sequential numbers at regular intervals.</li><li>timer() – Emits after a delay or at intervals.</li></ul><p>📌 <em>Use Case:</em> Want to simulate a stream of values or wrap an API call promise into an observable? Use of() or from().</p><h3>🔁 2. Transformation Operators</h3><p>Used to <strong>transform the emitted data</strong> from an observable into a new observable.</p><p><strong>Examples:</strong></p><ul><li>map() – Projects each value to a new value.</li><li>switchMap() – Switches to a new observable and cancels the previous one.</li><li>mergeMap() – Projects each value to an observable and merges them concurrently.</li><li>concatMap() – Similar to mergeMap() but runs observables sequentially.</li></ul><p>📌 <em>Use Case:</em> Use switchMap() for HTTP requests in Angular components to cancel old calls when new ones arrive (e.g., search autocomplete).</p><h3>🚦 3. Filtering Operators</h3><p>These help to <strong>filter out</strong> unwanted emissions from a stream.</p><p><strong>Examples:</strong></p><ul><li>filter() – Emits values that satisfy a condition.</li><li>take(n) – Takes the first n values.</li><li>debounceTime() – Emits a value after a pause (great for input debouncing).</li><li>distinctUntilChanged() – Emits only if the value has changed.</li></ul><p>📌 <em>Use Case:</em> Combine debounceTime() and distinctUntilChanged() to limit API calls on input changes.</p><h3>⏳ 4. Combination Operators</h3><p>Used to <strong>combine multiple observables</strong> into one.</p><p><strong>Examples:</strong></p><ul><li>combineLatest() – Emits when any observable emits, after all have emitted once.</li><li>forkJoin() – Waits for all observables to complete, then emits a combined result.</li><li>zip() – Combines emissions by index.</li><li>withLatestFrom() – Combines source observable with the latest value from another observable.</li></ul><p>📌 <em>Use Case:</em> Use forkJoin() for parallel HTTP requests that should complete together (e.g., form data + settings).</p><h3>🔧 5. Utility Operators</h3><p>Provide <strong>miscellaneous functionality</strong> like debugging, timing, and side effects.</p><p><strong>Examples:</strong></p><ul><li>tap() – Performs a side effect (e.g., logging) without modifying the stream.</li><li>finalize() – Invoked when the observable completes or errors out.</li></ul><p>📌 <em>Use Case:</em> Log API request data using tap() or show/hide loaders using finalize().</p><h3>🛑 6. Error Handling Operators</h3><p>Allow you to <strong>catch, retry, or handle errors</strong> in the observable chain.</p><p><strong>Examples:</strong></p><ul><li>catchError() – Catches and handles errors.</li><li>retry() – Re-subscribes a number of times upon error.</li><li>retryWhen() – Re-subscribes based on a custom strategy.</li></ul><p>📌 <em>Use Case:</em> Retry a failing API up to 3 times using retry(3) or provide a fallback using catchError().</p><h3>Final Thoughts 💡</h3><p>Mastering RxJS isn’t just about memorizing operators — it’s about understanding how data flows, how to manage it efficiently, and how to keep your app reactive and maintainable.</p><p>📘 If you’re working with Angular or any reactive JavaScript framework, investing time into learning RxJS operators is a game changer for scalable architecture and cleaner async logic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edbfde0895f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Object Iteration in JavaScript: A Comprehensive Guide]]></title>
            <link>https://jhapriti09.medium.com/mastering-object-iteration-in-javascript-a-comprehensive-guide-9e682c6373eb?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e682c6373eb</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Tue, 03 Dec 2024 15:55:19 GMT</pubDate>
            <atom:updated>2024-12-03T15:55:19.621Z</atom:updated>
            <content:encoded><![CDATA[<p>Efficiently working with objects is a fundamental skill for any JavaScript developer. Whether you’re traversing keys, values, or deeply nested structures, understanding different iteration techniques can significantly enhance your code’s readability and performance. This guide dives into the six most common ways to iterate through objects in JavaScript, including practical examples and best practices for working with complex data structures.</p><h3>1. Using for...in Loop</h3><p>The for...in loop iterates over all enumerable properties of an object.</p><pre>const obj = { name: &#39;Alice&#39;, age: 25, city: &#39;New York&#39; };<br><br>for (const key in obj) {<br>  console.log(`${key}: ${obj[key]}`);<br>}<br><br><br>//Output<br>name: Alice<br>age: 25<br>city: New York</pre><h3>2. Using Object.keys()</h3><p>The Object.keys() method returns an array of an object&#39;s keys. You can then use forEach() or a loop to iterate over the keys.</p><pre>const obj = { name: &#39;Alice&#39;, age: 25, city: &#39;New York&#39; };<br><br>Object.keys(obj).forEach((key) =&gt; {<br>  console.log(`${key}: ${obj[key]}`);<br>});</pre><h3>3. Using Object.values()</h3><p>The Object.values() method returns an array of the object&#39;s values. Iterate over them if you&#39;re only interested in the values.</p><pre>const obj = { name: &#39;Alice&#39;, age: 25, city: &#39;New York&#39; };<br><br>Object.values(obj).forEach((value) =&gt; {<br>  console.log(value);<br>});</pre><h3>4. Using Object.entries()</h3><p>The Object.entries() method returns an array of [key, value] pairs. It&#39;s useful for iterating over both keys and values.</p><pre>const obj = { name: &#39;Alice&#39;, age: 25, city: &#39;New York&#39; };<br><br>Object.entries(obj).forEach(([key, value]) =&gt; {<br>  console.log(`${key}: ${value}`);<br>});</pre><h3>5. Using for...of with Object.entries()</h3><p>If you prefer a for...of loop, combine it with Object.entries()</p><pre>const obj = { name: &#39;Alice&#39;, age: 25, city: &#39;New York&#39; };<br><br>for (const [key, value] of Object.entries(obj)) {<br>  console.log(`${key}: ${value}`);<br>}</pre><h3>6. Iterating Nested Objects</h3><p>If the object contains nested objects, you can use recursion to iterate through them.</p><pre>const nestedObj = { name: &#39;Alice&#39;, details: { age: 25, city: &#39;New York&#39; } };<br><br>function iterate(obj) {<br>  for (const key in obj) {<br>    if (typeof obj[key] === &#39;object&#39; &amp;&amp; obj[key] !== null) {<br>      iterate(obj[key]); // Recursive call<br>    } else {<br>      console.log(`${key}: ${obj[key]}`);<br>    }<br>  }<br>}<br><br>iterate(nestedObj);</pre><h3>Best Practice</h3><ul><li>Use Object.entries() for clean key-value pair iteration.</li><li>Use Object.keys() or Object.values() if you only need keys or values.</li><li>Use for...in cautiously as it also iterates over inherited properties unless filtered with hasOwnProperty.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e682c6373eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference between CSS Grid and CSS Flexbox?]]></title>
            <link>https://jhapriti09.medium.com/difference-between-css-grid-and-css-flexbox-dba91075a477?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/dba91075a477</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Mon, 09 Sep 2024 11:40:22 GMT</pubDate>
            <atom:updated>2024-09-09T11:42:25.958Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7dDt65J0bDJdVcb0ofjYIA.jpeg" /></figure><p>Flexbox and CSS Grid are both powerful layout systems in CSS, but they serve different purposes and have distinct features. Here’s a breakdown of their differences:</p><h3>Flexbox</h3><p><strong>1. Purpose:</strong></p><ul><li><strong>One-dimensional layout:</strong> Flexbox is designed for arranging items in a single dimension, either a row or a column. It’s great for aligning and distributing space within a container along one axis.</li></ul><p><strong>2. Layout Direction:</strong></p><ul><li><strong>Axis-based:</strong> Flexbox operates along a main axis (horizontal or vertical) and a cross axis (perpendicular to the main axis). You can control the direction of items along the main axis with flex-direction, and align items along the cross axis with properties like align-items.</li></ul><p><strong>3. Key Properties:</strong></p><ul><li>display: flex; — Defines a flex container.</li><li>flex-direction — Defines the direction of the main axis (e.g., row, column).</li><li>justify-content — Aligns items along the main axis (e.g., center, space-between).</li><li>align-items — Aligns items along the cross axis (e.g., flex-start, center).</li><li>flex-grow, flex-shrink, and flex-basis — Control the size of items within the container.</li></ul><p><strong>4. Use Cases:</strong></p><ul><li><strong>Navbars:</strong> Aligning items horizontally or vertically within a navbar.</li><li><strong>Card Layouts:</strong> Arranging cards in a single row or column.</li><li><strong>Centering Items:</strong> Horizontally or vertically centering content.</li></ul><p><strong>5. Flexibility:</strong></p><ul><li><strong>Dynamic Content:</strong> Items in a flex container can grow or shrink based on available space. Flexbox makes it easy to create fluid layouts that adapt to different screen sizes.</li></ul><h3>CSS Grid</h3><p><strong>1. Purpose:</strong></p><ul><li><strong>Two-dimensional layout:</strong> CSS Grid is designed for arranging items in both rows and columns simultaneously. It’s ideal for creating complex grid-based layouts where items can span multiple rows and columns.</li></ul><p><strong>2. Layout Direction:</strong></p><ul><li><strong>Grid-based:</strong> Grid operates on a grid system with rows and columns. You define a grid with rows and columns, and then place items into specific grid areas or cells.</li></ul><p><strong>3. Key Properties:</strong></p><ul><li>display: grid; — Defines a grid container.</li><li>grid-template-rows and grid-template-columns — Define the sizes of rows and columns.</li><li>grid-gap — Defines the spacing between rows and columns.</li><li>grid-area — Allows items to span multiple rows and columns.</li><li>justify-items and align-items — Align items within their grid cells.</li></ul><p><strong>4. Use Cases:</strong></p><ul><li><strong>Complex Layouts:</strong> Creating intricate layouts with rows and columns, such as dashboards or magazine layouts.</li><li><strong>Layout Templates:</strong> Defining reusable layout templates where items can be placed in specific grid areas.</li><li><strong>Asymmetrical Designs:</strong> Building layouts with asymmetrical or overlapping elements.</li></ul><p><strong>5. Flexibility:</strong></p><ul><li><strong>Static Content:</strong> Grid is great for layouts where the number of rows and columns is known and relatively fixed. It provides precise control over the layout structure.</li></ul><h3>Summary:</h3><ul><li><strong>Flexbox</strong> is best for simpler, one-dimensional layouts where you need to align and distribute items along a single axis. It excels in scenarios where content size is dynamic or unknown.</li><li><strong>CSS Grid</strong> is suited for more complex, two-dimensional layouts where you need precise control over both rows and columns. It’s ideal for structured layouts with multiple items spanning different areas.</li></ul><p><strong>Choosing Between Flexbox and Grid:</strong></p><ul><li><strong>Use Flexbox</strong> when dealing with linear layouts or when you need to align items along a single axis.</li><li><strong>Use Grid</strong> when you require a more complex layout with both rows and columns, or when you need to control item placement in a two-dimensional space.</li></ul><p>In many cases, you might use both Flexbox and Grid together to leverage the strengths of each for different parts of your layout.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dba91075a477" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is CI/CD? How does it improve the software development process?]]></title>
            <link>https://jhapriti09.medium.com/what-is-ci-cd-how-does-it-improve-the-software-development-process-839c3f88d05c?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/839c3f88d05c</guid>
            <category><![CDATA[trending]]></category>
            <category><![CDATA[deploymen]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Wed, 04 Sep 2024 08:37:20 GMT</pubDate>
            <atom:updated>2024-09-04T08:38:02.267Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ni6grKsoG6XsoE10t-MMsQ.jpeg" /></figure><p><strong>CI/CD </strong>stands for Continuous Integration and Continuous Delivery/Deployment.</p><ul><li><strong>Continuous Integration (CI) </strong>is the practice of automatically integrating code changes from multiple contributors into a shared repository several times a day. This integration process includes automated testing, which ensures that new code does not break existing functionality.</li><li><strong>Continuous Delivery (CD)</strong> is the practice of automating the release process, allowing code to be deployed to production environments automatically. The deployment is triggered manually, but the code is always in a deployable state.</li><li><strong>Continuous Deployment (CD)</strong> goes a step further by automating the deployment to production, ensuring that every change that passes automated testing is deployed directly to users.</li></ul><p><strong>Benefits:</strong></p><ul><li><strong>Faster feedback:</strong> Immediate detection of errors through automated tests.</li><li><strong>Reduced manual effort: </strong>Automation of builds, tests, and deployments.</li><li><strong>Improved code quality:</strong> Regular integration and testing lead to fewer bugs and better code quality.</li><li><strong>Faster time to market:</strong> Continuous delivery ensures that new features reach users quickly.</li></ul><h3>Some popular CI/CD tools include:</h3><ul><li><strong>Jenkins</strong>: Open-source automation server with a vast plugin ecosystem.</li><li><strong>GitLab CI/CD</strong>: Integrated CI/CD pipeline within GitLab, known for its seamless integration with Git.</li><li><strong>CircleCI: CI/CD</strong> platform that allows for easy setup and scalable pipelines.</li><li><strong>Travis CI</strong>: Simple CI service for open-source projects hosted on GitHub.</li><li><strong>Azure DevOps</strong>: A comprehensive set of tools for DevOps, including CI/CD pipelines.</li><li><strong>AWS CodePipeline</strong>: Managed service for CI/CD on AWS.</li></ul><p>I have used <strong>Azure Devops</strong> in multiple projects, particularly for its flexibility and extensive plugin support. The setup was straightforward, and it allowed us to build complex pipelines with ease.</p><p>Here are some benefits of using <strong>Azure DevOps CI/CD</strong> based on my experience:</p><ol><li><strong>Integrated Toolset:</strong> Azure DevOps provides an integrated suite of tools for version control (Azure Repos), CI/CD (Azure Pipelines), artifact management (Azure Artifacts), and testing (Azure Test Plans). This integration simplifies the setup and management of the entire DevOps lifecycle.</li><li><strong>Scalability:</strong> Azure DevOps is highly scalable, allowing you to handle both small projects and large, complex enterprise applications. It supports scaling across multiple teams and environments with ease.</li><li><strong>Customization and Flexibility:</strong> Azure Pipelines offer extensive customization options. You can define complex build and release pipelines using YAML files or a visual editor, enabling you to tailor the CI/CD process to fit specific project needs.</li><li><strong>Built-In Security:</strong> Azure DevOps includes features like pipeline secrets management, compliance tracking, and role-based access control (RBAC), ensuring that your CI/CD process adheres to security best practices.</li><li><strong>Automated Testing:</strong> Azure Pipelines support automated testing at various stages, allowing you to integrate unit tests, integration tests, and even load tests into your CI/CD pipeline. This helps ensure code quality and stability before deployment.</li><li><strong>Continuous Monitoring:</strong> Azure DevOps integrates with Azure Monitor and Application Insights, providing continuous monitoring and feedback for deployed applications. This allows for proactive issue detection and faster resolution.</li><li><strong>Cross-Platform Support:</strong> Azure DevOps supports a wide range of platforms and languages, making it suitable for diverse development environments, whether you’re working with .NET, Java, Node.js, Python, or other technologies.</li><li><strong>Cost-Effective: </strong>Azure DevOps offers a pay-as-you-go pricing model, making it cost-effective for organizations of all sizes. It also provides free tiers for small teams or open-source projects.</li></ol><p>Using <strong>Azure DevOps CI/CD</strong> in your project likely enhanced your development process by streamlining workflows, improving code quality, and accelerating delivery cycles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=839c3f88d05c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ES6 features in javascript:]]></title>
            <link>https://jhapriti09.medium.com/es6-features-in-javascript-954cc2210f0d?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/954cc2210f0d</guid>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Thu, 25 Jul 2024 11:27:14 GMT</pubDate>
            <atom:updated>2024-07-25T11:27:14.471Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ni6grKsoG6XsoE10t-MMsQ.jpeg" /></figure><p>Here are some essential ES6 features you can discuss in an interview:</p><h3>1. Let and Const</h3><ul><li><strong>let</strong>: Allows you to declare block-scoped variables, which are limited to the block, statement, or expression where they are used.</li><li><strong>const</strong>: Allows you to declare variables that are block-scoped and cannot be reassigned.</li></ul><h3>2Arrow Function</h3><ul><li>Arrow functions provide a concise syntax for writing function expressions and lexically bind the this value.</li></ul><p>Example:</p><pre>const add = (a, b) =&gt; a + b;<br>console.log(add(2, 3)); // 5</pre><h3>3. Template Literals</h3><ul><li>Template literals allow for multi-line strings and expression interpolation.</li></ul><p>Example:</p><pre>const name = &#39;John&#39;;<br>const greeting = `Hello, ${name}!`;<br>console.log(greeting); // Hello, John!</pre><h3>4. Default Parameters</h3><ul><li>Default parameters allow you to set default values for function parameters.</li></ul><p>Example:</p><pre>function greet(name = &#39;Guest&#39;) {<br>  return `Hello, ${name}`;<br>}<br>console.log(greet()); // Hello, Guest</pre><h3>5. Destructuring Assignment</h3><ul><li>Destructuring allows you to unpack values from arrays or properties from objects into distinct variables.</li></ul><p>Example:</p><pre>// Array destructuring<br>const [a, b] = [1, 2];<br>console.log(a); // 1<br>console.log(b); // 2<br>// Object destructuring<br>const { name, age } = { name: &#39;Alice&#39;, age: 25 };<br>console.log(name); // Alice<br>console.log(age); // 25</pre><h3>6. Rest and Spread Operators</h3><ul><li>The rest operator (...) allows you to represent an indefinite number of arguments as an array.</li><li>The spread operator (...) allows you to expand an array or object into individual elements.</li></ul><p>Example:</p><pre>// Rest operator<br>function sum(...numbers) {<br>  return numbers.reduce((total, num) =&gt; total + num, 0);<br>}<br>console.log(sum(1, 2, 3)); // 6<br>// Spread operator<br>const arr1 = [1, 2, 3];<br>const arr2 = [...arr1, 4, 5, 6];<br>console.log(arr2); // [1, 2, 3, 4, 5, 6]</pre><h3>7. Classes</h3><ul><li>ES6 introduces classes, which are syntactical sugar over JavaScript’s existing prototype-based inheritance.</li></ul><p>Example:</p><pre>class Person {<br>  constructor(name, age) {<br>    this.name = name;<br>    this.age = age;<br>  }</pre><pre>  greet() {<br>    return `Hello, my name is ${this.name} and I am ${this.age} years old.`;<br>  }<br>}</pre><pre>const john = new Person(&#39;John&#39;, 30);<br>console.log(john.greet()); // Hello, my name is John and I am 30 years old.</pre><h3>8. Promises</h3><ul><li>Promises provide a way to handle asynchronous operations.</li></ul><p>Example:</p><pre>const fetchData = () =&gt; {<br>  return new Promise((resolve, reject) =&gt; {<br>    setTimeout(() =&gt; {<br>      resolve(&#39;Data received&#39;);<br>    }, 1000);<br>  });<br>};<br>fetchData().then(data =&gt; console.log(data)); // Data received</pre><h3>9. Modules</h3><ul><li>ES6 introduces the module system, which allows you to export and import functions, objects, or primitives from one module to another.</li></ul><p>Example: // module.js</p><pre>export const add = (a, b) =&gt; a + b;</pre><p>// main.js</p><pre>import { add } from &#39;./module.js&#39;;<br>console.log(add(2, 3)); // 5</pre><h3>10. Enhanced Object Literals</h3><ul><li>ES6 enhances the object literal syntax, making it more concise and expressive.</li></ul><p>Example:</p><pre>const name = &#39;John&#39;;<br>const age = 30;</pre><pre>const person = {<br>  name,<br>  age,<br>  greet() {<br>    return `Hello, my name is ${this.name}`;<br>  }<br>};</pre><pre>console.log(person.greet()); // Hello, my name is John</pre><h3>Conclusion</h3><p>Highlighting these features during an interview demonstrates your knowledge of modern JavaScript and your ability to write clean, efficient, and maintainable code.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F3FeFnwfz6NY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D3FeFnwfz6NY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F3FeFnwfz6NY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/605f1cac11b13ad18cea5ae0050b02eb/href">https://medium.com/media/605f1cac11b13ad18cea5ae0050b02eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=954cc2210f0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Hoisting in JavaScript with an example?]]></title>
            <link>https://jhapriti09.medium.com/what-is-hoisting-in-javascript-with-an-example-04dd071a60e0?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/04dd071a60e0</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Thu, 04 Jul 2024 08:56:30 GMT</pubDate>
            <atom:updated>2024-07-04T08:56:30.686Z</atom:updated>
            <content:encoded><![CDATA[<p>Hoisting in JavaScript is a behavior in which variable and function declarations are moved to the top of their containing scope (global or function) during the compile phase, before the code execution. However, only the declarations are hoisted, not the initializations.</p><p><strong>Variable Hoisting</strong></p><p>For variables declared with var, the declaration is hoisted but not the initialization.</p><pre>console.log(a); // Output: undefined<br>var a = 5;<br>console.log(a); // Output: 5<br><br></pre><p>In the example above, the variable a is hoisted to the top of its scope, so the first console.log(a) doesn&#39;t throw an error but returns undefined because the initialization (a = 5) is not hoisted.</p><p><strong>Function Hoisting</strong><br>Function declarations are fully hoisted, meaning both the declaration and the body of the function are moved to the top of their scope.</p><pre>hoistedFunction(); // Output: &quot;This function is hoisted!&quot;<br><br>function hoistedFunction() {<br>    console.log(&quot;This function is hoisted!&quot;);<br>}<br><br></pre><p>In this case, the function hoistedFunction can be called before its actual declaration in the code.</p><p><strong>Let and Const</strong><br>Variables declared with let and const are also hoisted but are not initialized. They remain in a &quot;temporal dead zone&quot; from the start of the block until the declaration is encountered.</p><pre>console.log(b); // ReferenceError: Cannot access &#39;b&#39; before initialization<br>let b = 10;<br>console.log(b); // Output: 10<br><br>console.log(c); // ReferenceError: Cannot access &#39;c&#39; before initialization<br>const c = 20;<br>console.log(c); // Output: 20<br><br></pre><p>In the above example, accessing b or c before their declarations will throw a ReferenceError because they are in the temporal dead zone.</p><pre>console.log(x); // undefined<br>var x = 10;<br><br>hoisted(); // &quot;Function hoisted!&quot;<br>function hoisted() {<br>    console.log(&quot;Function hoisted!&quot;);<br>}<br><br>console.log(y); // ReferenceError: Cannot access &#39;y&#39; before initialization<br>let y = 20;<br><br>console.log(z); // ReferenceError: Cannot access &#39;z&#39; before initialization<br>const z = 30;<br><br></pre><p>In summary:</p><p>Variables declared with var are hoisted but initialized to undefined.<br>Function declarations are fully hoisted.<br>Variables declared with let and const are hoisted but not initialized, leading to a temporal dead zone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04dd071a60e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an Angular Nx library for an AuthGuard implementation:]]></title>
            <link>https://jhapriti09.medium.com/creating-an-angular-nx-library-for-an-authguard-implementation-b7020cd4af34?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7020cd4af34</guid>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 12:23:50 GMT</pubDate>
            <atom:updated>2024-06-03T12:23:50.794Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQMfMPTHkhZQNi_6AlRtgw.jpeg" /></figure><h3>1. Setup Nx Workspace</h3><p>First, you need to set up an Nx workspace if you haven’t already.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*ESM4MaT5a9LXraXMl9tUUA.png" /><figcaption>Follow the prompts to set up your workspace.</figcaption></figure><h3>2. Generate a Library</h3><p>Generate a new library within the Nx workspace where the AuthGuard will be implemented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*_-zHrMgfIATvcBLUiW3uzA.png" /></figure><h3>3. Create the AuthGuard</h3><p>Navigate to the library directory and create an AuthGuard using the Angular CLI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*U8Rta-64KGzOkmky3d2B_w.png" /></figure><p>This command generates a new guard and places it in the libs/auth/src/lib/guards directory.</p><h3>4. Implement the AuthGuard Logic</h3><p>Edit the generated AuthGuard file to include your authentication logic. Here’s an example implementation:</p><pre>import { Injectable } from &#39;@angular/core&#39;;<br>import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from &#39;@angular/router&#39;;<br>import { Observable } from &#39;rxjs&#39;;<br>import { AuthService } from &#39;../services/auth.service&#39;;<br><br>@Injectable({<br>  providedIn: &#39;root&#39;<br>})<br>export class AuthGuard implements CanActivate {<br><br>  constructor(private authService: AuthService, private router: Router) {}<br><br>  canActivate(<br>    next: ActivatedRouteSnapshot,<br>    state: RouterStateSnapshot): Observable&lt;boolean | UrlTree&gt; | Promise&lt;boolean | UrlTree&gt; | boolean | UrlTree {<br>    <br>    const isAuthenticated = this.authService.isAuthenticated();<br>    if (!isAuthenticated) {<br>      this.router.navigate([&#39;/login&#39;]);<br>    }<br>    return isAuthenticated;<br>  }<br>}</pre><h3>5. Create an AuthService</h3><p>Create an AuthService to handle the authentication logic.</p><p>Generate a service in the libs/auth/src/lib/services directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*xlSIKRpmJjdl71GNQsiL3w.png" /></figure><p>Implement the AuthService:</p><pre>import { Injectable } from &#39;@angular/core&#39;;<br><br>@Injectable({<br>  providedIn: &#39;root&#39;<br>})<br>export class AuthService {<br><br>  constructor() { }<br><br>  isAuthenticated(): boolean {<br>    // Implement your authentication check logic here<br>    // For example, check if a token exists in localStorage<br>    return !!localStorage.getItem(&#39;auth_token&#39;);<br>  }<br>}</pre><h3>6. Provide the AuthGuard and AuthService</h3><p>Ensure the AuthGuard and AuthService are provided in the library module.</p><p>In libs/auth/src/lib/auth.module.ts, add the following:</p><pre>import { NgModule } from &#39;@angular/core&#39;;<br>import { CommonModule } from &#39;@angular/common&#39;;<br>import { AuthGuard } from &#39;./guards/auth.guard&#39;;<br>import { AuthService } from &#39;./services/auth.service&#39;;<br><br>@NgModule({<br>  imports: [<br>    CommonModule<br>  ],<br>  providers: [<br>    AuthGuard,<br>    AuthService<br>  ]<br>})<br>export class AuthModule { }</pre><h3>7. Export the AuthGuard and AuthService</h3><p>Update the public-api.ts file to export the AuthGuard and AuthService:</p><pre>export * from &#39;./lib/guards/auth.guard&#39;;<br>export * from &#39;./lib/services/auth.service&#39;;<br>export * from &#39;./lib/auth.module&#39;;</pre><h3>8. Use the AuthGuard in Your Application</h3><p>Now, you can use the AuthGuard in your application. Import the AuthModule in your app module and use the guard in your routes.</p><p>In apps/your-app/src/app/app.module.ts:</p><pre>import { NgModule } from &#39;@angular/core&#39;;<br>import { BrowserModule } from &#39;@angular/platform-browser&#39;;<br>import { AuthModule } from &#39;@myorg/auth&#39;; // Adjust the import to match your library path<br><br>@NgModule({<br>  declarations: [<br>    AppComponent<br>  ],<br>  imports: [<br>    BrowserModule,<br>    AuthModule<br>  ],<br>  bootstrap: [AppComponent]<br>})<br>export class AppModule { }</pre><p>In apps/your-app/src/app/app-routing.module.ts:</p><pre>import { NgModule } from &#39;@angular/core&#39;;<br>import { RouterModule, Routes } from &#39;@angular/router&#39;;<br>import { AuthGuard } from &#39;@myorg/auth&#39;; // Adjust the import to match your library path<br><br>const routes: Routes = [<br>  {<br>    path: &#39;protected&#39;,<br>    canActivate: [AuthGuard],<br>    loadChildren: () =&gt; import(&#39;./protected/protected.module&#39;).then(m =&gt; m.ProtectedModule)<br>  },<br>  { path: &#39;login&#39;, loadChildren: () =&gt; import(&#39;./login/login.module&#39;).then(m =&gt; m.LoginModule) },<br>  { path: &#39;&#39;, redirectTo: &#39;/login&#39;, pathMatch: &#39;full&#39; }<br>];<br><br>@NgModule({<br>  imports: [RouterModule.forRoot(routes)],<br>  exports: [RouterModule]<br>})<br>export class AppRoutingModule { }</pre><h3>Conclusion</h3><p>You’ve successfully created an Angular Nx library with an AuthGuard implementation. This guard can now be used to protect routes in your Angular applications. You can expand on this by adding more functionality to the AuthService and configuring the AuthGuard as needed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7020cd4af34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[what is web content accessibility guidlines?]]></title>
            <link>https://jhapriti09.medium.com/what-is-web-content-accessibility-guidlines-41147573b289?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/41147573b289</guid>
            <category><![CDATA[trending]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Thu, 25 Apr 2024 09:03:59 GMT</pubDate>
            <atom:updated>2024-04-25T09:03:59.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ouqLKp_AtbRpGKh845Nz_Q.jpeg" /></figure><p>The Web Content Accessibility Guidelines (WCAG) are a set of guidelines developed by the World Wide Web Consortium (W3C) to ensure that web content is accessible to people with disabilities. These guidelines provide recommendations for making web content more accessible to users with various disabilities, including visual, auditory, physical, speech, cognitive, and neurological disabilities.</p><p>WCAG is organized around four principles, which are:</p><ol><li>Perceivable: Information and user interface components must be presentable to users in ways they can perceive. This includes providing text alternatives for non-text content, such as images, videos, and audio.</li><li>Operable: User interface components and navigation must be operable. This means ensuring that users can navigate and interact with the website using a variety of input methods, such as keyboard, mouse, or touch screen.</li><li>Understandable: Information and the operation of the user interface must be understandable. This involves making content clear and easy to comprehend, as well as ensuring consistency in design and functionality throughout the website.</li><li>Robust: Content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies. This means using coding practices that are compatible with different browsers and devices, as well as ensuring compatibility with assistive technologies like screen readers and speech recognition software.</li></ol><p>WCAG is organized into three levels of conformance: A (the lowest), AA, and AAA (the highest). Conformance with WCAG is often required by law in many countries and regions, and it’s considered best practice for creating inclusive and accessible web content for all users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41147573b289" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing Share Option in JavaScript: A Web Share API Guide]]></title>
            <link>https://jhapriti09.medium.com/implementing-share-option-in-javascript-a-web-share-api-guide-0c720d24e27e?source=rss-c3f1085ef802------2</link>
            <guid isPermaLink="false">https://medium.com/p/0c720d24e27e</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Priti Jha]]></dc:creator>
            <pubDate>Fri, 23 Feb 2024 11:27:21 GMT</pubDate>
            <atom:updated>2024-02-23T11:27:21.197Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zlg6Iy9nkmryzBpwrKqBOQ.jpeg" /></figure><p>Sharing content is a common functionality in web applications, and the Web Share API in JavaScript provides a seamless way to integrate native sharing capabilities into your web pages. In this blog post, we’ll explore how to implement a share option using the Web Share API, allowing users to easily share content from your web application.</p><h3>What is the Web Share API?</h3><p>The Web Share API is a browser feature that enables web applications to trigger the native sharing dialog of the user’s device. This API simplifies the process of implementing social sharing by providing a consistent way to invoke the sharing functionality across different platforms.</p><h3>Checking for Web Share API Support</h3><p>Before implementing the share option, it’s essential to check if the Web Share API is supported in the user’s browser. Here’s a simple check you can include in your JavaScript code:</p><pre>if (navigator.share) {<br>  // Web Share API is supported<br>  // Implement sharing functionality here<br>} else {<br>  // Web Share API is not supported<br>  // Provide a fallback or notify the user<br>  console.warn(&#39;Web Share API not supported on this browser&#39;);<br>}</pre><h3>Implementing the Share Option</h3><p>Assuming the Web Share API is supported, you can create a share button in your HTML and add an event listener to trigger the sharing dialog. Below is a basic example:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot;&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>  &lt;title&gt;Share Example&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br><br>&lt;button id=&quot;shareButton&quot;&gt;Share&lt;/button&gt;<br><br>&lt;script&gt;<br>if (navigator.share) {<br>  const shareButton = document.getElementById(&#39;shareButton&#39;);<br><br>  shareButton.addEventListener(&#39;click&#39;, async () =&gt; {<br>    try {<br>      // Use the Web Share API to trigger the native sharing dialog<br>      await navigator.share({<br>        title: &#39;Share Example&#39;,<br>        text: &#39;Check out this awesome content!&#39;,<br>        url: window.location.href<br>      });<br><br>      console.log(&#39;Shared successfully&#39;);<br>    } catch (error) {<br>      console.error(&#39;Error sharing:&#39;, error.message);<br>    }<br>  });<br>} else {<br>  console.warn(&#39;Web Share API not supported on this browser&#39;);<br>}<br>&lt;/script&gt;<br><br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>In this example:</p><ul><li>We check for Web Share API support using navigator.share.</li><li>If supported, we add a click event listener to a button with the id “shareButton.”</li><li>When the button is clicked, we use the navigator.share method to trigger the native sharing dialog. The method takes an object with properties like title, text, and url to define the content to be shared.</li><li>If sharing is successful, a success message is logged to the console. If there’s an error, the error message is logged.</li></ul><h3>Considerations and Best Practices</h3><ul><li>HTTPS Requirement: Ensure that your website is served over HTTPS, as the Web Share API requires a secure context.</li><li>Fallbacks: Provide fallback options or alternative sharing methods for browsers that do not support the Web Share API.</li><li>User Experience: Consider the user experience and make sure the shared content is appropriately formatted for different platforms.</li></ul><p>By implementing the Web Share API, you can enhance the user experience on your website by enabling a straightforward and native way for users to share content with their networks. As always, test your implementation across different browsers to ensure a consistent experience for all users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c720d24e27e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>