<?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: SHUBHAM GUPTA</title>
    <description>The latest articles on DEV Community by SHUBHAM GUPTA (@shubhamgupta00).</description>
    <link>https://dev.to/shubhamgupta00</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%2F1010008%2F80b0b34b-d931-40e4-a629-21a6933e94cf.png</url>
      <title>DEV Community: SHUBHAM GUPTA</title>
      <link>https://dev.to/shubhamgupta00</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shubhamgupta00"/>
    <language>en</language>
    <item>
      <title>Some popular JS topics</title>
      <dc:creator>SHUBHAM GUPTA</dc:creator>
      <pubDate>Tue, 17 Jan 2023 17:47:26 +0000</pubDate>
      <link>https://dev.to/shubhamgupta00/some-popular-js-topics-3gkd</link>
      <guid>https://dev.to/shubhamgupta00/some-popular-js-topics-3gkd</guid>
      <description>&lt;p&gt;This blog post is mainly beneficial for freshers who started interviews. As a Fresher, I know its very difficult to face interviews and answer the questions.&lt;/p&gt;

&lt;p&gt;Here, I mentioned some popular topics with proper definition which is useful during your interview preparation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closure-
&lt;/h2&gt;

&lt;p&gt;A function bundle with its lexical environment forms the closure.&lt;/p&gt;

&lt;p&gt;In other words, a Closure gives you access to outer function scope from an inner function. In JS, closures are created everytime a function is created at function creation time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function x(){
var a =7;
function y(){
console.log(a);
}
y();
}
x();

//output:- 7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whenever function is returned, even if its vanished in execution context but still it remember the reference it was pointing too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Uses Of Closure:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Module design Pattern&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Currying&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Memoize&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Hoisting-
&lt;/h2&gt;

&lt;p&gt;Hoisting in JavaScript is a behavior in which a function or a variable can be used before declaration.&lt;/p&gt;

&lt;p&gt;Hoisting is a behavior in JavaScript where variable and function declarations are moved to the top of their scope.&lt;/p&gt;

&lt;p&gt;In JavaScript, variable declarations are moved to the top of their scope (either the global scope or a function scope) during the compilation phase. This means that you can reference a variable before it is actually declared in your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;getName();
console.log(x);
var x=7;
function getName(){
console.log("Hello!");
}
//output:
//Hello!
//undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Event Loop-
&lt;/h2&gt;

&lt;p&gt;Event Loop in JS is a mechanism through which the 'calls waiting for execution' in the callback queue/job queue can be put on the call stack. For any event from the callback queue/job queue to come to call stack, the call stack will have to be empty.&lt;/p&gt;

&lt;h2&gt;
  
  
  DOM-
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Document Object Model(DOM)&lt;/strong&gt; is a programming interface for HTML and XML documents. It represents the structure of a document as a tree-like hierarchy of nodes, allowing programs to access and manipulate the content and structure of a document. The DOM can be used with any programming language, such as JS to make dynamic changes to a webpage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Function Borrowing-
&lt;/h2&gt;

&lt;p&gt;Function Borrowing allows us to use the methods of one object on a different object without having to make a copy of that method and maintain it in two separate places. It is accomplished through the use of call(), apply(), bind().&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let name={
firstName:"shubham",
lastName:"gupta",
printName:function(){
console.log(this.firstName + " " + this.lastName);
}}

let name2={
firstName:"shivam",
lastName:"gupta"
}

name.printName.call(name2);
//output: shivam gupta
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all about for this post. I hope as a reader of this blog, you get knowledge about this topic after reading this post. Thank you!&lt;/p&gt;

</description>
      <category>api</category>
      <category>automation</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
