<?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: arpitashrivastav</title>
    <description>The latest articles on DEV Community by arpitashrivastav (@arpitashrivastav).</description>
    <link>https://dev.to/arpitashrivastav</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%2F712600%2F111b006b-10d9-42b3-81f0-5ff7b40c2f63.jpg</url>
      <title>DEV Community: arpitashrivastav</title>
      <link>https://dev.to/arpitashrivastav</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arpitashrivastav"/>
    <language>en</language>
    <item>
      <title>Currying in JavaScript</title>
      <dc:creator>arpitashrivastav</dc:creator>
      <pubDate>Sat, 31 Jan 2026 14:45:37 +0000</pubDate>
      <link>https://dev.to/arpitashrivastav/currying-4lam</link>
      <guid>https://dev.to/arpitashrivastav/currying-4lam</guid>
      <description>&lt;p&gt;Currying is advanced technique of working with functions.&lt;/p&gt;

&lt;p&gt;Currying is advanced technique of working with functions.Currying is advanced technique of working with functions.Currying is advanced technique of working with functions.Currying is advanced technique of working with functions.Currying is advanced technique of working with functions.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Call, Apply and Bind Method in JavaScript.</title>
      <dc:creator>arpitashrivastav</dc:creator>
      <pubDate>Mon, 26 Jun 2023 17:44:37 +0000</pubDate>
      <link>https://dev.to/arpitashrivastav/call-apply-and-bind-method-in-javascript-31fj</link>
      <guid>https://dev.to/arpitashrivastav/call-apply-and-bind-method-in-javascript-31fj</guid>
      <description>&lt;p&gt;Look at the code below to see how we defined a variable and specified a function within it to get the intended result. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--coMUn4gr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ylxjjl218jdw2kfkgi2.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--coMUn4gr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ylxjjl218jdw2kfkgi2.jpeg" alt="Image description" width="609" height="367"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Call Method
&lt;/h2&gt;

&lt;p&gt;Let's declare another variable, and if you think declaring that function again here will be acceptable, think again. This is not a good practise. So this is where call method comes in picture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DucWs8Un--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aq89bu4jihufp0q709wj.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DucWs8Un--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aq89bu4jihufp0q709wj.jpeg" alt="Image description" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Apply Method
&lt;/h2&gt;

&lt;p&gt;The apply method is extremely similar to the call method, with the main difference being how we pass arguments, with the first argument being a reference to this and the second argument being a list of the arguments that we pass in the function. Instead of sending these arguments individually using a coma in call method, we pass them in an array list to the apply method.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mZSgTVBh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oeak0oz13ycmrfrxz1af.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mZSgTVBh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oeak0oz13ycmrfrxz1af.jpeg" alt="Image description" width="800" height="428"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Bind Method
&lt;/h2&gt;

&lt;p&gt;The bind method is quite similar to the call method, with the exception that the bind method links this method (function name) with the object and then returns a copy of the method (that function). There is a catch over there that does not directly call the function but instead returns a duplicate of that function that we can call later.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EeWwRIql--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjlzn66y6lfrzadyx0lx.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EeWwRIql--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjlzn66y6lfrzadyx0lx.jpeg" alt="Image description" width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is Hoisting in JavaScript?</title>
      <dc:creator>arpitashrivastav</dc:creator>
      <pubDate>Mon, 26 Jun 2023 15:32:47 +0000</pubDate>
      <link>https://dev.to/arpitashrivastav/what-is-hoisting-in-javascript-2dap</link>
      <guid>https://dev.to/arpitashrivastav/what-is-hoisting-in-javascript-2dap</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zgJPN383--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kew79q980qgbasppvo5u.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zgJPN383--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kew79q980qgbasppvo5u.jpeg" alt="Image description" width="275" height="344"&gt;&lt;/a&gt;&lt;br&gt;
Did you note that in the preceding example, we declared a variable after the console.log of x and invoked the function before declaring it? But wasn't this a surprise given that we received undefined for a variable and the output of function but not an error?&lt;/p&gt;

&lt;p&gt;So if you didn't know this then let's learn about &lt;strong&gt;&lt;em&gt;hoisting&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
 in JavaScript.&lt;/p&gt;

&lt;p&gt;A phenomenon in JavaScript by which we can access variables and functions before declaring it, is known as &lt;strong&gt;&lt;em&gt;hoisting&lt;/em&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How this happens?
&lt;/h2&gt;

&lt;p&gt;This is because the variables are already assigned with a spatial value of &lt;strong&gt;&lt;em&gt;undefined&lt;/em&gt;&lt;/strong&gt; in the memory space during the memory creation phase.&lt;br&gt;
In the case of functions, the &lt;strong&gt;entire code&lt;/strong&gt; is kept in memory space.&lt;br&gt;
Thus because they are stored during the 1st phase which is the memory creation phase, is the reason we don't get any error when we run the code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Are Arrow functions hoisted?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UpFE4msr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/myiha76juoosqc08k7ms.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UpFE4msr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/myiha76juoosqc08k7ms.jpeg" alt="Image description" width="477" height="295"&gt;&lt;/a&gt;&lt;br&gt;
As we can see that when we attempted to invoke the getName function before declaring it in the arrow function, we received a &lt;strong&gt;&lt;em&gt;TypeError&lt;/em&gt;&lt;/strong&gt;, indicating that getName is not a function.&lt;/p&gt;

&lt;p&gt;This occurred because when we attempted to execute this arrow function, it issued an error since it operates similarly to a variable. So, just as variables are allocated as undefined in a memory space, arrow functions are also allocated as undefined in the memory space during the memory creation phase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Are let and const hoisted?
&lt;/h2&gt;

&lt;p&gt;Yes, let and const are hoisted, but not in the same way that var declarations are. So, if we try to access let and const before declarations, we receive a &lt;strong&gt;ReferrenceError&lt;/strong&gt; that states they are not defined.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--za4np_MT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ylg9drvezsoxxej6ubt6.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--za4np_MT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ylg9drvezsoxxej6ubt6.jpeg" alt="Image description" width="635" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So how will we know they've been hoisted?&lt;/p&gt;

&lt;p&gt;So it is because we have var x in the global scope whereas a and b are in a different scope, which is script.&lt;/p&gt;

&lt;p&gt;So in the memory creation phase even a and b are assigned an undefined spatial value in the memory space, but it is just saved in another memory space.&lt;/p&gt;

&lt;p&gt;So they've been hoisted, but why are we still getting a ReferrenceError?&lt;/p&gt;

&lt;p&gt;This is because let and const are hoisted but they are in the &lt;strong&gt;Temporal Dead Zone&lt;/strong&gt; for the time being.&lt;/p&gt;

&lt;h2&gt;
  
  
  Temporal Dead Zone
&lt;/h2&gt;

&lt;p&gt;The time period between the variables being hoisted to until they are assigned a value is known as the temporal dead zone.&lt;/p&gt;

&lt;p&gt;As we can see below, we initialised the variable at line 3, hence anything above line 3 was the temporal dead zone for a.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--APXA1Iwl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/41ngkycaaz8n3mnau2vc.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--APXA1Iwl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/41ngkycaaz8n3mnau2vc.jpeg" alt="Image description" width="277" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, based on the information provided above, we can deduce that hoisting occurs in conventional function declarations and variable declarations of var let and const, however there is a variation in behaviour with let, const, and var.&lt;/p&gt;

&lt;p&gt;Thank you for taking the time to read this.&lt;br&gt;
I hope you found this useful.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
