<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abhishek Raj</title>
    <description>The latest articles on DEV Community by Abhishek Raj (@abhishekraj272).</description>
    <link>https://dev.to/abhishekraj272</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F419056%2F462b1794-0cb4-4ae6-8bd4-8577be4f295e.jpeg</url>
      <title>DEV Community: Abhishek Raj</title>
      <link>https://dev.to/abhishekraj272</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abhishekraj272"/>
    <language>en</language>
    <item>
      <title>Running while(true) in JS</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Sat, 18 Dec 2021 11:37:53 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/running-whiletrue-in-js-1aoh</link>
      <guid>https://dev.to/abhishekraj272/running-whiletrue-in-js-1aoh</guid>
      <description>&lt;p&gt;You must be wondering this guy is MAD, we can't run while/for loop &lt;strong&gt;synchronously&lt;/strong&gt; client side in &lt;em&gt;javascript&lt;/em&gt;, it will block the main thread and will FREEZE the page.&lt;/p&gt;

&lt;p&gt;Well, it is possible to run it but not a good way to do it and might introduce some bugs in your program.&lt;/p&gt;

&lt;h4&gt;
  
  
  Web Worker
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;Web Worker runs in a single thread isolated from the main thread, so you can run any synchronous operation without blocking the thread.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can run the loop in Web Worker and send the send the data from Web Worker to Main Thread using &lt;em&gt;postMessage&lt;/em&gt; method. It will run as good as main thread.&lt;/p&gt;

&lt;p&gt;You can try it in the below code snippet&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/WNZjWMe?height=600&amp;amp;default-tab=result,js&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Running synchronous loop is not advised in browser, unless there is a such requirement.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/abhishekraj272"&gt;Github&lt;/a&gt;, &lt;a href="https://twitter.com/abhishekraj272"&gt;Twitter&lt;/a&gt;, &lt;a href="https://www.youtube.com/channel/UCvHn2T8DSJzEWzYDdK3Dt8A"&gt;Youtube&lt;/a&gt; 😇&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>Sending Web Analytics the better way!!</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Thu, 16 Dec 2021 10:23:17 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/sending-web-analytics-the-better-way-1c1</link>
      <guid>https://dev.to/abhishekraj272/sending-web-analytics-the-better-way-1c1</guid>
      <description>&lt;p&gt;Most of the big companies have there own analytics rather than using third party services like Google Analytics.&lt;/p&gt;

&lt;p&gt;I have seen many of the sites using &lt;strong&gt;fetch API&lt;/strong&gt; or &lt;strong&gt;XHRHttpReq&lt;/strong&gt; for sending analytics event.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's the issue in using that fetch API/XHR for sending analytics event?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Even if its async, we are using our main thread to send the events.&lt;/li&gt;
&lt;li&gt;When the send analytics request is queued and user closes the page, your analytics is lost.&lt;/li&gt;
&lt;li&gt;Poor UX due to slow HTTP Requests, if we put analytics send req on document

&lt;code&gt;unload&lt;/code&gt;

event&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://www.smashingmagazine.com/2018/07/logging-activity-web-beacon-api/#can-t-we-already-do-this"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What should we do?
&lt;/h3&gt;

&lt;p&gt;Almost all browser's (except IE) gives an API for this use case.&lt;/p&gt;

&lt;h4&gt;
  
  
  Beacon API
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;The Beacon API is used to send an asynchronous and non-blocking request to a web server. The request does not expect a response. Unlike requests made using XMLHttpRequest or the Fetch API, the browser guarantees to initiate beacon requests before the page is unloaded and to run them to completion. - &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API"&gt;MDN&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Why is Beacon API good for sending analytics event?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;It doesn't block your thread.&lt;/li&gt;
&lt;li&gt;Browser queues it and takes care to sending the request.&lt;/li&gt;
&lt;li&gt;Even after queuing the page is closed, the request will be sent.&lt;/li&gt;
&lt;li&gt;It doesn't takes response from server, sends and forgets.&lt;/li&gt;
&lt;li&gt;Supported by most of the browsers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon#browser_compatibility"&gt;Browser Compatability&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Caveats
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;It only sends POST request.&lt;/li&gt;
&lt;li&gt;We can't check if request is received by server.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/abhishekraj272"&gt;Github&lt;/a&gt;, &lt;a href="https://twitter.com/abhishekraj272"&gt;Twitter&lt;/a&gt; 😃&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>discuss</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What I learned in 3 years of Web Dev?</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Sat, 21 Aug 2021 14:09:31 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/what-i-learned-in-3-years-of-web-dev-384n</link>
      <guid>https://dev.to/abhishekraj272/what-i-learned-in-3-years-of-web-dev-384n</guid>
      <description>&lt;h2&gt;
  
  
  1. DSA is more important than learning any new framework.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  2. Learn Javascript before learning any framework.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  3. Learn how JS Engine works.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  4. Always follow coding principles.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  5. Make as many projects as you can.
&lt;/h2&gt;

&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/abhishekraj272"&gt;Github&lt;/a&gt;, &lt;a href="https://twitter.com/abhishekraj272"&gt;Twitter&lt;/a&gt; 😇&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>JS Polyfills asked in Interviews</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Sat, 14 Aug 2021 07:44:20 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/js-polyfills-asked-in-interviews-19b3</link>
      <guid>https://dev.to/abhishekraj272/js-polyfills-asked-in-interviews-19b3</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;As Javascript community keeps adding new methods in Javascript, so all browsers doesn't support new JS methods.  &lt;/p&gt;

&lt;p&gt;To make your JS code run on every browser, you need to add it on your own or you can use &lt;a href="https://sotly.co/IXY6zCbd"&gt;Babel&lt;/a&gt;, &lt;a href="https://sotly.co/40bmc6Bp"&gt;CoreJS&lt;/a&gt;. Sometimes companies ask in &lt;strong&gt;interview&lt;/strong&gt; for Polyfills to know your understanding.  &lt;/p&gt;

&lt;p&gt;In this article, I will list out some Polyfills asked by companies.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Array Flat
&lt;/h2&gt;

&lt;p&gt;This method is used to flat a nested array.&lt;/p&gt;

&lt;p&gt;In the below example, we have used &lt;a href="https://sotly.co/tSFkt02X"&gt;recursion&lt;/a&gt; to solve this problem. We have created 2 cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A base case: If depth is reached then push arr in output and return it.&lt;/li&gt;
&lt;li&gt;A recursion case: Loop over array and check if its an Array or not. If its an array flat it, else push the number in output.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag__replit"&gt;
  &lt;iframe height="550px" src="https://repl.it/@abhishekraj2721/Array-Flat-JS?lite=true"&gt;&lt;/iframe&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  2. Array Filter
&lt;/h2&gt;

&lt;p&gt;This is a Higher Order Function which takes another function and filters the array on the basis of the function.&lt;/p&gt;

&lt;p&gt;In the below example, we have created a higher order function, which takes another function and calls on each element of the array. If it returns &lt;em&gt;true&lt;/em&gt; then that element is inserted into result.&lt;/p&gt;


&lt;div class="ltag__replit"&gt;
  &lt;iframe height="550px" src="https://repl.it/@abhishekraj2721/Array-Filter-JS?lite=true"&gt;&lt;/iframe&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  3. Array Reduce
&lt;/h2&gt;

&lt;p&gt;This is a Higher Order Function which takes another function and reduces the array to single value/object and returns it.&lt;/p&gt;

&lt;p&gt;In the below example, we have created a higher order function, which takes another function and calls on each element of the array. It mutates the result returned by the callback function.&lt;/p&gt;


&lt;div class="ltag__replit"&gt;
  &lt;iframe height="550px" src="https://repl.it/@abhishekraj2721/Array-Reduce-JS?lite=true"&gt;&lt;/iframe&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  4. Function Bind
&lt;/h2&gt;

&lt;p&gt;The bind method is used to pass an execution context to the function.&lt;/p&gt;

&lt;p&gt;In the below example, the custom Bind function takes the context and uses apply method to bind the function with the given context.&lt;/p&gt;


&lt;div class="ltag__replit"&gt;
  &lt;iframe height="550px" src="https://repl.it/@abhishekraj2721/Func-Bind-JS?lite=true"&gt;&lt;/iframe&gt;
&lt;/div&gt;


&lt;h5&gt;
  
  
  For more Awesome polyfills asked in interviews, check out &lt;a href="https://sotly.co/2_Dz2uUf"&gt;JSVault&lt;/a&gt;
&lt;/h5&gt;

&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/abhishekraj272"&gt;Github&lt;/a&gt;, &lt;a href="https://twitter.com/abhishekraj272"&gt;Twitter&lt;/a&gt;, &lt;a href="https://www.youtube.com/channel/UCvHn2T8DSJzEWzYDdK3Dt8A"&gt;Youtube&lt;/a&gt; 😇&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: I have written all the methods as pure functions, as I have only wanted to show the code. We can also use Prototypal Inheritance.  &lt;/p&gt;

&lt;p&gt;All the URLs in this post are powered by &lt;a href="https://app.sotly.co/"&gt;Sotly.co&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Top Interview Questions for Backend Developers(Node)</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Sat, 07 Aug 2021 17:18:29 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/top-interview-questions-for-backend-developers-node-2133</link>
      <guid>https://dev.to/abhishekraj272/top-interview-questions-for-backend-developers-node-2133</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Being a Full Stack Developer, I had appeared for Backend Developer position as well. In this post, I will be sharing most common Backend Dev question asked to me in all those interviews except the DSA part.&lt;/p&gt;

&lt;h2&gt;
  
  
  Q1. Create a sleep function using Async/Await.
&lt;/h2&gt;

&lt;p&gt;In the below example, the sleep function returns a promise which is resolved after given millisecond using setTimeout API.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/MWmzKPZ?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Q2. How Javascript Engine works?
&lt;/h2&gt;

&lt;p&gt;When a js file is ran,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;A global execution context is created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A memory heap is created where all variables (with var keyword) and functions (except arrow func) are declared.&lt;br&gt;&lt;br&gt;
In the below image we can see, variable &lt;strong&gt;a&lt;/strong&gt; is declared w/o even execution has started.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hhm6xi44nd77wt0w2sc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hhm6xi44nd77wt0w2sc.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A Call Stack is created which stores the line which is going to be executed.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9l92hu7kh951mk9w6flg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9l92hu7kh951mk9w6flg.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When &lt;em&gt;call stack&lt;/em&gt; gets a function call, it creates a &lt;em&gt;functional context&lt;/em&gt; and the process is repeated in the functional context.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When &lt;em&gt;call stack&lt;/em&gt; encounters WEB APIs like setTimeout/Interval/Immediate, these are sent to callback queue to process after call stack is empty.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When &lt;em&gt;call stack&lt;/em&gt; encounters a Promise it is sent to micro task queue (higher priority than callback queue) to process after call stack is empty.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once call stack is empty, event loop moves functions from queues to call stack for execution.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Q3. Difference between Single Threaded &amp;amp; Asynchronous.
&lt;/h2&gt;

&lt;p&gt;My View:&lt;br&gt;
Single Threaded -&amp;gt; It means only once function can be executed at a time.&lt;br&gt;
Async -&amp;gt; It is about non-blocking of execution of functions.&lt;/p&gt;

&lt;p&gt;In this below image, we can easily understand the difference. Thanks to &lt;a href="https://www.baeldung.com/" rel="noopener noreferrer"&gt;Baeldung&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0mjmugbgn2w6cucwvirp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0mjmugbgn2w6cucwvirp.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbepu91vawolbj365xtcm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbepu91vawolbj365xtcm.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.baeldung.com/cs/async-vs-multi-threading" rel="noopener noreferrer"&gt;Read More&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Q4. How to debug a slow API?
&lt;/h2&gt;

&lt;p&gt;My View:&lt;/p&gt;
&lt;h3&gt;
  
  
  The Console.log approach
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Check if the issue is with network by sending request from different network.&lt;/li&gt;
&lt;li&gt;Log time when &lt;em&gt;req&lt;/em&gt; is received by the backend.&lt;/li&gt;
&lt;li&gt;Log time before a DB query.&lt;/li&gt;
&lt;li&gt;Log time after a DB query.&lt;/li&gt;
&lt;li&gt;Log time before/after some heavy operation.&lt;/li&gt;
&lt;li&gt;Log time before sending response.&lt;/li&gt;
&lt;li&gt;Analyse the time, you will get your culprit.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Profiler Approach
&lt;/h3&gt;

&lt;p&gt;Use any profiling tool to check where the execution is lagging.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is EventEmitter in NodeJS?
&lt;/h2&gt;

&lt;p&gt;My View: EventEmitter is used to create event listeners in JS.&lt;/p&gt;

&lt;p&gt;Read More:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/abhishekraj272" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F419056%2F462b1794-0cb4-4ae6-8bd4-8577be4f295e.jpeg" alt="abhishekraj272"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/abhishekraj272/top-interview-questions-for-frontend-developers-3d5j" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Top Interview Questions for Frontend Developers(React)&lt;/h2&gt;
      &lt;h3&gt;Abhishek Raj ・ Jul 30 '21&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#career&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;div class="ltag__link"&gt;
  &lt;a href="/abhishekraj272" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F419056%2F462b1794-0cb4-4ae6-8bd4-8577be4f295e.jpeg" alt="abhishekraj272"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/abhishekraj272/if-you-don-t-know-this-you-don-t-know-javascript-2355" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Learn these awesome Javascript concepts.&lt;/h2&gt;
      &lt;h3&gt;Abhishek Raj ・ Aug 2 '21&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#career&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/abhishekraj272" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, &lt;a href="https://twitter.com/abhishekraj272" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://www.youtube.com/channel/UCvHn2T8DSJzEWzYDdK3Dt8A" rel="noopener noreferrer"&gt;Youtube&lt;/a&gt; 😇&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>career</category>
      <category>webdev</category>
      <category>node</category>
    </item>
    <item>
      <title>Learn these awesome Javascript concepts.</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Mon, 02 Aug 2021 18:54:51 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/if-you-don-t-know-this-you-don-t-know-javascript-2355</link>
      <guid>https://dev.to/abhishekraj272/if-you-don-t-know-this-you-don-t-know-javascript-2355</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;You must have seeing people abusing and hating JS, because they compare Javascript with other languages like Java, C++, Go but Javascript is entirely different.&lt;/p&gt;

&lt;p&gt;In this post I will be showing some cool things in javascript.&lt;/p&gt;

&lt;h3&gt;
  
  
  Generator Function ⚡
&lt;/h3&gt;

&lt;p&gt;These are a type of function which can pause and resume its execution.&lt;br&gt;&lt;br&gt;
In simple words, suppose you call this function and you want to pause it execution at a certain state/condition and after certain condition you want to again resume its execution, you can do using generator function.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/YzVjPrE?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In the above example, you can see &lt;strong&gt;generator function&lt;/strong&gt; are created using &lt;em&gt;Asterisk(*)&lt;/em&gt; after writing function and when you want to pause its execution use &lt;em&gt;yield&lt;/em&gt; and to stop use &lt;em&gt;return&lt;/em&gt;, you can even return values using yield.&lt;/p&gt;

&lt;p&gt;If you want to resume the execution, execute &lt;em&gt;.run()&lt;/em&gt; method of the generator object.&lt;/p&gt;

&lt;h4&gt;
  
  
  Usages
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Iterator&lt;/li&gt;
&lt;li&gt;Generating infinite number efficiently&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://code4developers.com/ways-to-use-generator-functions-in-javascript"&gt;Read More (Ctrl + Click)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/rfornal/use-cases-for-javascript-generators-1npc"&gt;Some More (Ctrl + Click)&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Async Await vs Generator Function ⏳
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Generator Functions and Async Functions can be used to write asynchronous code which can &lt;strong&gt;wait&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generator function always yields an object like {value: any, done: bool} but Async function returns a &lt;em&gt;promise&lt;/em&gt; to resolve or can throw an error if doesn't resolves.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generator function runs till yield and &lt;em&gt;pauses&lt;/em&gt; but Async function runs till await and &lt;em&gt;waits&lt;/em&gt; there.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://towardsdatascience.com/javascript-generator-yield-next-async-await-8442d2c77185"&gt;Read More&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Closure 🤏
&lt;/h3&gt;

&lt;p&gt;Closure is an environment, created inside a function which stores some variables and can be used by another function inside that scope.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/qBmydZo?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In the above example, you can see how the &lt;em&gt;parentName&lt;/em&gt; is bind with &lt;em&gt;child&lt;/em&gt; function.&lt;/p&gt;

&lt;h4&gt;
  
  
  Usages
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Hiding data inside function.&lt;/li&gt;
&lt;li&gt;Maintaining state.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Currying 🍛
&lt;/h3&gt;

&lt;p&gt;Suppose of you have a function with N arguments, converting it into N function calls with only 1 arguments, is called Currying in Javascript.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/zYwLGZP?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Famous Question: Create a currying function to give sum of N numbers e.g. function(1)(2)(3).....(N) = 1+2+3+...+N&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Usage
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Used to create Higher Order Function&lt;/li&gt;
&lt;li&gt;Memoization&lt;/li&gt;
&lt;li&gt;Error handling &lt;/li&gt;
&lt;li&gt;Initializing functions &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://towardsdatascience.com/javascript-currying-vs-partial-application-4db5b2442be8"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Higher Order Functions (HOF) 💪
&lt;/h3&gt;

&lt;p&gt;HOF accepts functions as argument and/or returns function with closure.&lt;/p&gt;

&lt;p&gt;E.g. Array methods like map, reduce, filter.....etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  Usage
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Binding functions with state&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://blog.alexdevero.com/higher-order-functions-javascript/"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Call, Apply &amp;amp; Bind 📞
&lt;/h3&gt;

&lt;p&gt;Call, Apply and Bind are JS methods using to bind object with &lt;strong&gt;this&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/rNmrVqJ?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In the above example, I have shown how you can use call, apply and bind.&lt;/p&gt;

&lt;h4&gt;
  
  
  Usage
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;DRY: Do Not Repeat Code&lt;/li&gt;
&lt;li&gt;Debouncing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://www.codingame.com/playgrounds/9799/learn-solve-call-apply-and-bind-methods-in-javascript"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/abhishekraj272"&gt;Github&lt;/a&gt;, &lt;a href="https://twitter.com/abhishekraj272"&gt;Twitter&lt;/a&gt;, &lt;a href="https://www.youtube.com/channel/UCvHn2T8DSJzEWzYDdK3Dt8A"&gt;Youtube&lt;/a&gt; 😇&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href="https://www.youtube.com/channel/UC3N9i_KvKZYP4F84FPIzgPQ"&gt;Akshay Saini&lt;/a&gt; for his amazing series on JS.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>career</category>
    </item>
    <item>
      <title>How to join DEV as a Dev?🤠</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Sat, 31 Jul 2021 18:55:30 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/how-to-join-dev-as-a-dev-d9k</link>
      <guid>https://dev.to/abhishekraj272/how-to-join-dev-as-a-dev-d9k</guid>
      <description>&lt;p&gt;Just wanted to know the procedure. &lt;br&gt;
You could also help. &lt;a class="mentioned-user" href="https://dev.to/ben"&gt;@ben&lt;/a&gt; &amp;amp;&amp;amp; &lt;a class="mentioned-user" href="https://dev.to/peter"&gt;@peter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>discuss</category>
      <category>career</category>
    </item>
    <item>
      <title>Top Interview Questions for Frontend Developers(React)</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Fri, 30 Jul 2021 18:18:40 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/top-interview-questions-for-frontend-developers-3d5j</link>
      <guid>https://dev.to/abhishekraj272/top-interview-questions-for-frontend-developers-3d5j</guid>
      <description>&lt;p&gt;In the past few days, I appeared for many frontend devs interview. So, in this post, I have compiled some of the most common question I was asked.&lt;/p&gt;

&lt;h3&gt;
  
  
  Q1. How would you optimise a slow React website?
&lt;/h3&gt;

&lt;p&gt;My View:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We can open the network tab and check if the issue is in frontend or backend. &lt;/li&gt;
&lt;li&gt;If the problem is with frontend, we can use a profiler to see where is the issue.
I think almost every frontend dev has heard about Lighthouse or GTMatrix.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2by60sy8kahy3bnxr1e.png" alt="image"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, the issue with these profiler is that they mostly give information about First Paint/ Time to Interative, etc... but suppose there is a table which gets rendered on each state change or a component is taking too long to compute, how'd you find?&lt;/p&gt;

&lt;p&gt;Here comes React Profiler for our rescue.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx7wleq95y2cx7k2339sl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx7wleq95y2cx7k2339sl.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see which component took how much time to render, then further we can memoize the component/functions taking forever to render.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html" rel="noopener noreferrer"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Q2. How would you design a loosely coupled React App?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovi5y1ra8q1hsg5gfkje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovi5y1ra8q1hsg5gfkje.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My Views:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Don’t repeat yourself: Whenever you see you have repeated a piece of code, try to create another component/function and break it into small pieces.&lt;/li&gt;
&lt;li&gt;Try to move API calls on the top components.&lt;/li&gt;
&lt;li&gt;Try to reduce number of props being passed.&lt;/li&gt;
&lt;li&gt;Try to use Higher Order Components whenever possible.&lt;/li&gt;
&lt;li&gt;Divide features in dedicated reducers.&lt;/li&gt;
&lt;li&gt;Last but not least, Use side-effects manager like Redux-Saga to handle side effects.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The more loosely coupled your application is, more scalable it will be.&lt;/p&gt;

&lt;h3&gt;
  
  
  Q3. When to use Redux Thunk &amp;amp; Redux Saga?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxq16n0z23uz34ddl4eub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxq16n0z23uz34ddl4eub.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: Redux Thunk is only 10 lines of code including function  name &amp;amp; curly braces (~300 bytes) 🥺&lt;br&gt;
Redux-Saga is around 13kb 🙂&lt;/p&gt;

&lt;p&gt;My View: If you are creating some small scale website then Redux Thunk is you child. Redux Saga is like having an extra thread in your web app which can easily handle any side effect, all thanks to generator functions.&lt;br&gt;
&lt;a href="https://medium.com/@shoshanarosenfield/redux-thunk-vs-redux-saga-93fe82878b2d" rel="noopener noreferrer"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Q4. Two Way Data Binding in React?
&lt;/h3&gt;

&lt;p&gt;My View: React has one way data binding, which means, data flow is from owner to child only, the child can't update the data directly. It will need to dispatch some actions/call the function required to update the data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9fc9q1jyk8na6s3kqk6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9fc9q1jyk8na6s3kqk6.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But in some cases two way data binding might be required.&lt;br&gt;
So, how'd you apply 2 way data binding, React provides some function to do that too.&lt;br&gt;
&lt;a href="https://reactjs.org/docs/two-way-binding-helpers.html" rel="noopener noreferrer"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Q5. Synthetic Events in React
&lt;/h3&gt;

&lt;p&gt;My View: Many of us have used Synthetic Events in React but very few of us knows about it. 😝&lt;br&gt;
Quoting React Docs here&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Your event handlers will be passed instances of SyntheticEvent, a cross-browser wrapper around the browser’s native event. It has the same interface as the browser’s native event, including stopPropagation() and preventDefault(), except the events work identically across all browsers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://reactjs.org/docs/events.html" rel="noopener noreferrer"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;All the given answers are my own views, if you think I might be wrong, do comment it down below. I am open for discussions. 😃&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/abhishekraj272" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, &lt;a href="https://twitter.com/abhishekraj272" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;, &lt;a href="https://www.youtube.com/channel/UCvHn2T8DSJzEWzYDdK3Dt8A" rel="noopener noreferrer"&gt;Youtube&lt;/a&gt; 😇&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>career</category>
    </item>
    <item>
      <title>Mastering Drag N Drop API in HTML &amp; JS 😎</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Sun, 25 Jul 2021 17:19:50 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/mastering-drag-n-drop-api-in-html-js-36a9</link>
      <guid>https://dev.to/abhishekraj272/mastering-drag-n-drop-api-in-html-js-36a9</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Few days back, I was working on a side project and I was required to create a Drag N Drop feature like &lt;a href="https://scratch.mit.edu/projects/editor/"&gt;Scratch&lt;/a&gt;, then I read a lot about this Drag n Drop feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;In this post, I will be showing 3 Drag n Drop use case, so without wasting the time, let's start.&lt;/p&gt;

&lt;h3&gt;
  
  
  Drag n Drop Simple
&lt;/h3&gt;

&lt;p&gt;Here, I have created 2 container div, where we can move our child divs. While dragging we will store &lt;strong&gt;id&lt;/strong&gt; of the child in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer"&gt;DataTransfer&lt;/a&gt; Object and after dropping we will fetch the &lt;strong&gt;id&lt;/strong&gt; from the DataTansfer Object then it will the node will be appended in the dropped container.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/LYyeRXP?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Drag, Drop, Copy n Delete
&lt;/h3&gt;

&lt;p&gt;Similarly, I have created 2 container divs, where we can move the child, but when we drop the child, it is copy-pasted instead of cut-paste. &lt;br&gt;
When it is redropped in the previous container, it is deleted.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/XWRVdym?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Drag, Drop n Swap
&lt;/h3&gt;

&lt;p&gt;Here, we have 1 container and we can swap (left to right) nodes.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/KKmZNNG?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/"&gt;Linkedin&lt;/a&gt; &lt;a href="https://github.com/abhishekraj272"&gt;Github&lt;/a&gt; &lt;a href="https://twitter.com/abhishekraj272"&gt;Twitter&lt;/a&gt; &lt;a href="https://www.youtube.com/channel/UCvHn2T8DSJzEWzYDdK3Dt8A"&gt;Youtube&lt;/a&gt; 😇&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href="https://web.dev"&gt;Web.dev&lt;/a&gt; &amp;amp; &lt;a href="https://www.w3schools.com/"&gt;W3Schools&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Centering a DIV like a PRO - #1</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Mon, 19 Jul 2021 13:57:10 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/centering-a-div-like-a-pro-1-49kf</link>
      <guid>https://dev.to/abhishekraj272/centering-a-div-like-a-pro-1-49kf</guid>
      <description>&lt;p&gt;In this series of article, I will show some best ways to center a div in HTML.&lt;/p&gt;

&lt;p&gt;In the below &lt;strong&gt;codepen&lt;/strong&gt;, I have used &lt;em&gt;inset&lt;/em&gt; to set top, right, bottom, left to 0, then setting the margin to auto.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/abhishekraj272/embed/MWmoBYO?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/"&gt;Linkedin&lt;/a&gt; &lt;a href="https://github.com/abhishekraj272"&gt;Github&lt;/a&gt; &lt;a href="https://twitter.com/abhishekraj272"&gt;Twitter&lt;/a&gt; &lt;a href="https://www.youtube.com/channel/UCvHn2T8DSJzEWzYDdK3Dt8A"&gt;Youtube&lt;/a&gt; 😇&lt;/p&gt;

&lt;p&gt;Thanks @&lt;a href="https://www.youtube.com/channel/UCJZv4d5rbIKd4QHMPkcABCw"&gt;Kevin Powell&lt;/a&gt; for this trick.&lt;/p&gt;

</description>
      <category>html</category>
      <category>webdev</category>
      <category>css</category>
      <category>frontend</category>
    </item>
    <item>
      <title>How I created in-memory DOM?</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Thu, 15 Jul 2021 15:51:31 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/how-i-created-this-mini-virtual-dom-13lp</link>
      <guid>https://dev.to/abhishekraj272/how-i-created-this-mini-virtual-dom-13lp</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.morioh.com%2F200626%2Fb35254e4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.morioh.com%2F200626%2Fb35254e4.jpg" alt="Virtual DOM"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://morioh.com" rel="noopener noreferrer"&gt;Img Credits&lt;/a&gt;  &lt;/p&gt;
&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Few weeks back, I had a task to create an online code editor for HTML, CSS, JS and show the output on the same screen.&lt;/p&gt;
&lt;h3&gt;
  
  
  Why I needed in-memory DOM?
&lt;/h3&gt;

&lt;p&gt;I stored different codes in different variables and for showing the output on same screen, I had to create a virtual DOM and merge all the codes (HTML + CSS + JS) together and inject it into an iframe.&lt;/p&gt;
&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The above code takes HTML, CSS and Javascript as string and then combines them together in HTML. It returns the merged code as a string then it is injected into an iframe.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;You can see the working of the above code in this app.&lt;br&gt;
&lt;a href="https://abhishekraj272.github.io/Bro-Code-Web-IDE/" rel="noopener noreferrer"&gt;Web Code Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Edit 1.&lt;/em&gt;&lt;br&gt;
Changed the title from VDOM to in-memory DOM, as I mistook it for a VDOM.&lt;br&gt;
Thanks @lukeshiru for the suggestion.&lt;/p&gt;

&lt;h4&gt;
  
  
  Img Credits
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://crello.com" rel="noopener noreferrer"&gt;Crello&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://morioh.com" rel="noopener noreferrer"&gt;Morioh&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>html</category>
    </item>
    <item>
      <title>You need to build a collaborative text editor RIGHT NOW!!</title>
      <dc:creator>Abhishek Raj</dc:creator>
      <pubDate>Thu, 17 Jun 2021 08:27:48 +0000</pubDate>
      <link>https://dev.to/abhishekraj272/you-need-to-build-a-collaborative-text-editor-right-now-5fcj</link>
      <guid>https://dev.to/abhishekraj272/you-need-to-build-a-collaborative-text-editor-right-now-5fcj</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3s89r4l772hf6jzw1ftf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3s89r4l772hf6jzw1ftf.png" alt="Code Editor Light Mode"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;By building a collaborative text editor you will get to learn&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Send data from server to client - Polling/Sockets&lt;/li&gt;
&lt;li&gt;Algo/DS to use for efficient data transfer - Text Compare&lt;/li&gt;
&lt;li&gt;Update editor in such way, user's cursor doesn't move.
There are way too many things it will teach you, read the below post to learn more or Try out the live project here -&amp;gt; &lt;a href="https://sotly.co/bro-ide" rel="noopener noreferrer"&gt;Live URL&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Recently, I started working on this cool project, a Web Based Code Editor. So, in this post I will talk about how I implemented this project and what will be the further features I will be adding. 😃&lt;/p&gt;

&lt;h2&gt;
  
  
  Preface
&lt;/h2&gt;

&lt;p&gt;As we all know there are thousands of AWESOMEEE code editors out there like repl.it, codepen, codesandbox, etc. So most you must be wondering why I decided to write my own code editors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7y1hsf5883j433uj0hkb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7y1hsf5883j433uj0hkb.png" alt="Am I Stupid?"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;What I think is, if you build a system then you will get to know how that thing really works, so my curiosity made me do it. 🙂&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;p&gt;Lets talk about the features this web app currently has,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separate tabs for HTML/CSS/JS for better coding style.&lt;/li&gt;
&lt;li&gt;Code Output Display, shows the output by merging all codes and creating a Virtual DOM.&lt;/li&gt;
&lt;li&gt;Fully Mobile Responsive.&lt;/li&gt;
&lt;li&gt;Download merged code as text file.&lt;/li&gt;
&lt;li&gt;Night Mode&lt;/li&gt;
&lt;li&gt;Code auto save in browser&lt;/li&gt;
&lt;li&gt;Code Sharing Link (Planned)&lt;/li&gt;
&lt;li&gt;Code Collaboration (Planned)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tech Used
&lt;/h2&gt;

&lt;p&gt;In this project, I have used,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React - For UI&lt;/li&gt;
&lt;li&gt;Material UI - Design/Animation&lt;/li&gt;
&lt;li&gt;Redux - For State Management&lt;/li&gt;
&lt;li&gt;Redux Saga - For Side Effects&lt;/li&gt;
&lt;li&gt;Redux Persist - For Auto Save&lt;/li&gt;
&lt;li&gt;Socket IO (Planned) - For socket connection&lt;/li&gt;
&lt;li&gt;JsDiff - For Calculating Difference&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Contribution
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.drupal.org%2Ffiles%2Fcontribute.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.drupal.org%2Ffiles%2Fcontribute.png" alt="Contribute"&gt;&lt;/a&gt;&lt;br&gt;
This project is open for contributions, even contribution to docs, readme, managing people will help others learn and we can grow together.&lt;br&gt;
This is the repo url -&amp;gt; &lt;a href="https://github.com/abhishekraj272/Bro-Code-Web-IDE" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try out the live project here -&amp;gt; &lt;a href="https://sotly.co/bro-ide" rel="noopener noreferrer"&gt;Live URL&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Connect Me @ &lt;a href="https://www.linkedin.com/in/abhishekraj272/" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt; &lt;a href="https://github.com/abhishekraj272" rel="noopener noreferrer"&gt;Github&lt;/a&gt; &lt;a href="https://twitter.com/abhishekraj272" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; &lt;a href="https://www.youtube.com/channel/UCvHn2T8DSJzEWzYDdK3Dt8A" rel="noopener noreferrer"&gt;Youtube&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.instagram.com/abhishek.r.a.j" rel="noopener noreferrer"&gt;Instagram&lt;/a&gt; 😇&lt;/p&gt;

&lt;p&gt;Ping Me Anytime with doubts related to Full Stack / Pen Testing&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>showdev</category>
      <category>node</category>
    </item>
  </channel>
</rss>
