<?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: Bhupesh Chandra Joshi</title>
    <description>The latest articles on DEV Community by Bhupesh Chandra Joshi (@bhupeshchandrajoshi).</description>
    <link>https://dev.to/bhupeshchandrajoshi</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%2F1931767%2Ffb73ef56-faf6-4992-9ee8-6ce544b122b6.jpeg</url>
      <title>DEV Community: Bhupesh Chandra Joshi</title>
      <link>https://dev.to/bhupeshchandrajoshi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bhupeshchandrajoshi"/>
    <language>en</language>
    <item>
      <title>Serialization and Deserialization a long drive</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Thu, 26 Mar 2026 08:22:03 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/serialization-and-deserialization-a-long-drive-36dn</link>
      <guid>https://dev.to/bhupeshchandrajoshi/serialization-and-deserialization-a-long-drive-36dn</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.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%2F37s6j13uc0o9vr51pn3s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F37s6j13uc0o9vr51pn3s.png" alt=" " width="800" height="1200"&gt;&lt;/a&gt;Serialization: &lt;/p&gt;

&lt;p&gt;You are sailing over the ocean and imagine you are a columbus, you found the treasure on the ocean, you want to send the information back to the spain.&lt;/p&gt;

&lt;p&gt;You require the letter (to drap map and direction ),&lt;/p&gt;

&lt;p&gt;In similar manner ,Serialization is converting a complex object to string/json object that easly stored in dB, sent over the network and stored into local storage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fcammlcu4jfoixbtcrdhf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fcammlcu4jfoixbtcrdhf.png" alt=" " width="800" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deserialization:&lt;br&gt;
     You have sent the letter to the spain, that is letter ,stored maps and directions. and goverment needs to understand it's meaning , they need to reconstruct the idea on letter or maps into the meaningful story and description.&lt;/p&gt;

&lt;p&gt;The converting stored format object to easy to access object is Deserialization.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbssmvli9v1kevoa3vxhd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbssmvli9v1kevoa3vxhd.jpg" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Concepts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Purpose: &lt;br&gt;
  You are columbus , you have embedded the letter and draw the map that enables others to understand, we convert into the json , so other programming language  , or application understand the data.&lt;/p&gt;

&lt;p&gt;Common Formats: &lt;br&gt;
  Columbus created a letter of JSON (human-readable)&lt;br&gt;
, XML, binary formats (compact and fast, like Protocol Buffers or BSON).&lt;/p&gt;

&lt;p&gt;Why Serialization Matters&lt;br&gt;
 Persistence: &lt;br&gt;
  When you open call of duty , you save the level completed status to  file or database.&lt;/p&gt;

&lt;p&gt;Data Transmission: Data transfer ex- you send your text to google search.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>chaicode</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>Template Literals in JavaScript</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Mon, 16 Mar 2026 16:43:51 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/template-literals-in-javascript-2591</link>
      <guid>https://dev.to/bhupeshchandrajoshi/template-literals-in-javascript-2591</guid>
      <description>&lt;h1&gt;
  
  
  Template Literals in JavaScript: Writing Cleaner and Smarter Strings
&lt;/h1&gt;

&lt;p&gt;Modern JavaScript has evolved significantly to improve developer productivity and code readability. One feature that dramatically improved how developers work with strings is &lt;strong&gt;Template Literals&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Before ES6 (ECMAScript 2015), developers relied on &lt;strong&gt;string concatenation using the &lt;code&gt;+&lt;/code&gt; operator&lt;/strong&gt;, which often made code messy and hard to read. Template literals solved this problem by introducing a more intuitive way to build strings.&lt;/p&gt;

&lt;p&gt;In this article, we will explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problems with traditional string concatenation&lt;/li&gt;
&lt;li&gt;Template literal syntax&lt;/li&gt;
&lt;li&gt;Embedding variables in strings (String Interpolation)&lt;/li&gt;
&lt;li&gt;Multi-line strings&lt;/li&gt;
&lt;li&gt;Real-world use cases in modern JavaScript&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  The Problem with Traditional String Concatenation
&lt;/h1&gt;

&lt;p&gt;Before template literals, developers used the &lt;code&gt;+&lt;/code&gt; operator to combine strings and variables.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example (Old Approach)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bhupesh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;profession&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;JavaScript Developer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, my name is &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; and I am a &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;profession&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello, my name is Bhupesh and I am a JavaScript Developer.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Issues with this approach
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Poor readability&lt;/strong&gt; when many variables are involved&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard to maintain&lt;/strong&gt; in long strings&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error-prone&lt;/strong&gt;, especially when mixing quotes and variables&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multi-line strings are difficult&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example of a complex concatenation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Laptop&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;80000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Product: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
                    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;, Price: ₹&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
                    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;, Available in stock.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When applications grow, such code becomes difficult to manage.&lt;/p&gt;




&lt;h1&gt;
  
  
  Template Literals Syntax
&lt;/h1&gt;

&lt;p&gt;Template literals were introduced in &lt;strong&gt;ES6&lt;/strong&gt; and use &lt;strong&gt;backticks (&lt;code&gt;&lt;/code&gt;)&lt;/strong&gt; instead of quotes.&lt;/p&gt;

&lt;p&gt;Inside template literals, JavaScript allows embedding expressions using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;expression&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Basic Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bhupesh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;profession&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;JavaScript Developer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Hello, my name is &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; and I am a &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;profession&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello, my name is Bhupesh and I am a JavaScript Developer.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The syntax is much cleaner and easier to read.&lt;/p&gt;




&lt;h1&gt;
  
  
  Before vs After (Comparison)
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Traditional Concatenation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bhupesh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;course&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;JavaScript&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;User &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; is learning &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;course&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Template Literals
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bhupesh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;course&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;JavaScript&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`User &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; is learning &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;course&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt; Same output, but the template literal version is significantly cleaner.&lt;/p&gt;




&lt;h1&gt;
  
  
  Embedding Variables in Strings (String Interpolation)
&lt;/h1&gt;

&lt;p&gt;Template literals allow variables and expressions to be directly inserted inside strings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tax&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.18&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Total amount after tax: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;tax&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Total amount after tax: 590
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can embed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Variables&lt;/li&gt;
&lt;li&gt;Mathematical expressions&lt;/li&gt;
&lt;li&gt;Function calls&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example with function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`Hello &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, welcome to JavaScript!`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bhupesh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Multi-line Strings
&lt;/h1&gt;

&lt;p&gt;Before template literals, multi-line strings required awkward formatting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Old Approach
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;JavaScript is powerful.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
             &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;It runs in browsers.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
             &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;It powers modern web applications.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  With Template Literals
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`JavaScript is powerful.
It runs in browsers.
It powers modern web applications.`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes template literals extremely useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML templates&lt;/li&gt;
&lt;li&gt;Emails&lt;/li&gt;
&lt;li&gt;Logs&lt;/li&gt;
&lt;li&gt;Documentation strings&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Real-World Use Cases in Modern JavaScript
&lt;/h1&gt;

&lt;p&gt;Template literals are heavily used in real-world applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Dynamic HTML Generation
&lt;/h2&gt;

&lt;p&gt;Frontend developers frequently generate HTML dynamically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bhupesh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;role&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Admin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`
&amp;lt;div class="user-card"&amp;gt;
  &amp;lt;h2&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/h2&amp;gt;
  &amp;lt;p&amp;gt;Role: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach is commonly used in &lt;strong&gt;React, Vue, and vanilla JavaScript UI rendering&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Logging and Debugging
&lt;/h2&gt;

&lt;p&gt;Template literals simplify debugging.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;api&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`API endpoint &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; responded with status &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;API endpoint &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;api&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; responded with status &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. Building API URLs
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`https://api.example.com/users/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. Generating SQL Queries (Backend Example)
&lt;/h2&gt;

&lt;p&gt;In Node.js applications:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`SELECT * FROM users WHERE id = &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: In production, always use &lt;strong&gt;parameterized queries&lt;/strong&gt; to prevent SQL injection.&lt;/p&gt;




&lt;h1&gt;
  
  
  Visualization: String Interpolation Concept
&lt;/h1&gt;

&lt;p&gt;Imagine template literals as a &lt;strong&gt;string template with placeholders&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Template:  Hello ${name}, welcome to ${platform}

Variables:
name = Bhupesh
platform = JavaScript

Final Output:
Hello Bhupesh, welcome to JavaScript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;${}&lt;/code&gt; section works like a &lt;strong&gt;dynamic placeholder&lt;/strong&gt; that gets replaced with actual values.&lt;/p&gt;




&lt;h1&gt;
  
  
  When Should You Use Template Literals?
&lt;/h1&gt;

&lt;p&gt;Template literals should be preferred when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Combining strings with variables&lt;/li&gt;
&lt;li&gt;Writing multi-line text&lt;/li&gt;
&lt;li&gt;Creating dynamic HTML&lt;/li&gt;
&lt;li&gt;Logging values&lt;/li&gt;
&lt;li&gt;Generating dynamic URLs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They improve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Readability&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Maintainability&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Developer productivity&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Key Takeaways
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Template literals were introduced in &lt;strong&gt;ES6&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;They use &lt;strong&gt;backticks (&lt;code&gt;&lt;/code&gt;)&lt;/strong&gt; instead of quotes.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;${}&lt;/code&gt; allows &lt;strong&gt;string interpolation&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;They support &lt;strong&gt;multi-line strings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Widely used in &lt;strong&gt;modern frontend and backend JavaScript&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Template literals may seem like a small feature, but they significantly improve the way JavaScript developers write and manage strings. Cleaner syntax leads to more readable code, fewer bugs, and faster development.&lt;/p&gt;

&lt;p&gt;For developers building modern web applications with &lt;strong&gt;JavaScript, Node.js, or frameworks like React&lt;/strong&gt;, template literals are an essential part of everyday coding.&lt;/p&gt;




</description>
      <category>webdev</category>
      <category>chaicode</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Understanding the JavaScript Window Object</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Mon, 16 Mar 2026 15:36:28 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/understanding-the-javascript-window-object-jd5</link>
      <guid>https://dev.to/bhupeshchandrajoshi/understanding-the-javascript-window-object-jd5</guid>
      <description>&lt;h1&gt;
  
  
  Understanding the JavaScript Window Object: The Browser’s Global Powerhouse
&lt;/h1&gt;

&lt;p&gt;When developers start learning browser-side JavaScript, they usually interact with elements using &lt;code&gt;document.getElementById()&lt;/code&gt; or manipulate HTML through the DOM. However, behind the scenes, there is a &lt;strong&gt;larger object controlling the entire browser environment&lt;/strong&gt; — the &lt;strong&gt;Window Object&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Window object&lt;/strong&gt; acts as the &lt;strong&gt;top-level container of everything running in a browser tab&lt;/strong&gt;. Understanding this object helps developers clearly distinguish between &lt;strong&gt;Browser APIs (BOM)&lt;/strong&gt; and &lt;strong&gt;Document APIs (DOM)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let’s explore this powerful object step by step.&lt;/p&gt;




&lt;h1&gt;
  
  
  What is the Window Object?
&lt;/h1&gt;

&lt;p&gt;The &lt;strong&gt;Window object&lt;/strong&gt; represents the &lt;strong&gt;browser window or tab where your JavaScript is running&lt;/strong&gt;. It is the &lt;strong&gt;global object in the browser environment&lt;/strong&gt;, meaning that everything defined globally automatically becomes a property of the &lt;code&gt;window&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fp2y227uvtgcidn0jzltn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fp2y227uvtgcidn0jzltn.png" alt=" " width="800" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When executed in a browser console, this prints a large object containing browser APIs such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;document&lt;/li&gt;
&lt;li&gt;location&lt;/li&gt;
&lt;li&gt;history&lt;/li&gt;
&lt;li&gt;navigator&lt;/li&gt;
&lt;li&gt;localStorage&lt;/li&gt;
&lt;li&gt;timers&lt;/li&gt;
&lt;li&gt;dialog boxes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of the &lt;code&gt;window&lt;/code&gt; object as the &lt;strong&gt;root controller of the browser environment&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Window
 ├── Document (DOM)
 ├── Location
 ├── History
 ├── Navigator
 ├── LocalStorage
 └── Browser APIs
![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ira64xme0ayc356v1eym.png)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Global Scope and the &lt;code&gt;this&lt;/code&gt; Keyword
&lt;/h1&gt;

&lt;p&gt;In browser JavaScript, &lt;strong&gt;global variables and functions automatically become properties of the &lt;code&gt;window&lt;/code&gt; object&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;JavaScript&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sayHello&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello Developer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Behind the scenes, the browser interprets this as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;JavaScript&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sayHello&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello Developer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So these are equivalent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both return:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;JavaScript&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;code&gt;this&lt;/code&gt; at Global Level
&lt;/h3&gt;

&lt;p&gt;At the global scope in browsers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means the &lt;strong&gt;global execution context refers to the window object&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  Key Properties of the Window Object
&lt;/h1&gt;

&lt;p&gt;The Window object contains several &lt;strong&gt;important properties that provide access to browser capabilities&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. &lt;code&gt;window.document&lt;/code&gt; — Accessing the DOM
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;document&lt;/code&gt; property refers to the &lt;strong&gt;DOM (Document Object Model)&lt;/strong&gt; representing the HTML page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;title&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though we write &lt;code&gt;document&lt;/code&gt;, internally it is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;document&lt;/code&gt; object allows JavaScript to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;read HTML elements&lt;/li&gt;
&lt;li&gt;modify content&lt;/li&gt;
&lt;li&gt;attach event listeners&lt;/li&gt;
&lt;li&gt;manipulate styles&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. &lt;code&gt;window.location&lt;/code&gt; — URL Manipulation
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;location&lt;/code&gt; object provides information about the &lt;strong&gt;current page URL&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://google.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This redirects the browser to a new page.&lt;/p&gt;

&lt;p&gt;Useful properties:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;href&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Full URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hostname&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Domain name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pathname&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Page path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;protocol&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;http / https&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. &lt;code&gt;window.history&lt;/code&gt; — Browser Navigation
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;history&lt;/code&gt; object allows navigation through the &lt;strong&gt;browser session history&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;back&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Equivalent to clicking the &lt;strong&gt;back button&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Other methods:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forward&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;go&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;single-page applications&lt;/li&gt;
&lt;li&gt;navigation control&lt;/li&gt;
&lt;li&gt;custom routing systems&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. &lt;code&gt;window.navigator&lt;/code&gt; — Browser Information
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;navigator&lt;/code&gt; object provides &lt;strong&gt;information about the user’s browser and device&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;userAgent&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It can reveal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;browser type&lt;/li&gt;
&lt;li&gt;operating system&lt;/li&gt;
&lt;li&gt;device type&lt;/li&gt;
&lt;li&gt;language settings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  5. &lt;code&gt;window.localStorage&lt;/code&gt; and &lt;code&gt;sessionStorage&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;These APIs allow storing &lt;strong&gt;data inside the browser&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Local Storage
&lt;/h3&gt;

&lt;p&gt;Data persists even after the browser closes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;theme&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dark&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Retrieve data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;theme&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;theme&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Session Storage
&lt;/h3&gt;

&lt;p&gt;Data persists &lt;strong&gt;only during the browser session&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bhupesh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the tab closes, the data disappears.&lt;/p&gt;




&lt;h1&gt;
  
  
  Important Methods of the Window Object
&lt;/h1&gt;

&lt;p&gt;The Window object also provides several &lt;strong&gt;utility methods&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Dialog Boxes
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Alert
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Welcome to JavaScript&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Displays a message box.&lt;/p&gt;




&lt;h3&gt;
  
  
  Prompt
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Enter your name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Allows user input.&lt;/p&gt;




&lt;h3&gt;
  
  
  Confirm
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;confirm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Are you sure?&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;true or false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  2. Timers
&lt;/h1&gt;

&lt;p&gt;Timers allow delayed or repeated execution.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;setTimeout&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Runs code &lt;strong&gt;once after a delay&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello after 3 seconds&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;code&gt;setInterval&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Runs code &lt;strong&gt;repeatedly&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;setInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Running every second&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  3. Window Manipulation Methods
&lt;/h1&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;window.open()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Opens a new browser window.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://openai.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;code&gt;window.close()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Closes the current window (if opened via script).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;code&gt;window.scrollTo()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Scrolls to a specific position.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scrollTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This scrolls the page &lt;strong&gt;500px down&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  Difference Between &lt;code&gt;window&lt;/code&gt; (BOM) and &lt;code&gt;document&lt;/code&gt; (DOM)
&lt;/h1&gt;

&lt;p&gt;Many beginners confuse &lt;strong&gt;BOM&lt;/strong&gt; and &lt;strong&gt;DOM&lt;/strong&gt;, but they serve different roles.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Window (BOM)&lt;/th&gt;
&lt;th&gt;Document (DOM)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Represents&lt;/td&gt;
&lt;td&gt;Browser window&lt;/td&gt;
&lt;td&gt;HTML document&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Purpose&lt;/td&gt;
&lt;td&gt;Browser control&lt;/td&gt;
&lt;td&gt;Page content manipulation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Example&lt;/td&gt;
&lt;td&gt;location, history&lt;/td&gt;
&lt;td&gt;getElementById&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Level&lt;/td&gt;
&lt;td&gt;Top-level object&lt;/td&gt;
&lt;td&gt;Child of window&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Window (BOM)
   └── Document (DOM)
         └── HTML Elements
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example relationship:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Best Practices
&lt;/h1&gt;

&lt;h3&gt;
  
  
  1. You Usually Don’t Need to Write &lt;code&gt;window&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Because the &lt;code&gt;window&lt;/code&gt; object is global, writing it explicitly is optional.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Internally the browser reads this as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  2. Avoid Global Variables
&lt;/h3&gt;

&lt;p&gt;Since global variables attach to &lt;code&gt;window&lt;/code&gt;, excessive globals can pollute the environment.&lt;/p&gt;

&lt;p&gt;Bad practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bhupesh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Better practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bhupesh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. Use Storage Carefully
&lt;/h3&gt;

&lt;p&gt;Avoid storing sensitive data like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;passwords&lt;/li&gt;
&lt;li&gt;authentication tokens&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;inside &lt;code&gt;localStorage&lt;/code&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;The &lt;strong&gt;Window object is the backbone of browser-based JavaScript&lt;/strong&gt;. It provides access to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the DOM (&lt;code&gt;document&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;browser navigation (&lt;code&gt;history&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;URL control (&lt;code&gt;location&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;client storage (&lt;code&gt;localStorage&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;timers and dialog boxes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By understanding the &lt;strong&gt;Window object&lt;/strong&gt;, developers gain deeper insight into &lt;strong&gt;how JavaScript communicates with the browser environment&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In simple terms:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If JavaScript is the brain of a web page, the Window object is the entire operating system of the browser tab.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Mastering it will significantly improve your ability to build &lt;strong&gt;interactive, browser-aware applications&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>chaicode</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Dom(Document Object model/Methods )in JavaScript</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Mon, 16 Mar 2026 12:57:51 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/domdocument-object-methods-in-javascript-4f88</link>
      <guid>https://dev.to/bhupeshchandrajoshi/domdocument-object-methods-in-javascript-4f88</guid>
      <description>&lt;p&gt;What is DOM(Document Object model)? We are discussing the methods ,without methods our dom will not work.&lt;/p&gt;

&lt;p&gt;Tree representation of Html elements, Suraj kumar Jha, he is mentor in chaicode, discussed , what do I think?&lt;br&gt;
  It is a API(Application programming interface) for communicating with Html documents. Dom is client-side programming language, it creates a tree structure of html elements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Selecting Document Elements&lt;/strong&gt;&lt;br&gt;
 In client side javascript , we often need to modify one or more elements within our website. We have document object, we need to select the particular element from the web page, we select the elements with css selectors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;querySelector()&lt;/strong&gt;&lt;br&gt;
 mdn states that the query selector returns the first element which matches within the css selector.&lt;/p&gt;

&lt;p&gt;syntax:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ft4s087egqsfetxrzbjdf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ft4s087egqsfetxrzbjdf.png" alt=" " width="781" height="143"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Falftzssn7fb09epujo8q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Falftzssn7fb09epujo8q.png" alt=" " width="773" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fvdbjdmoaqappmywjhvsy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvdbjdmoaqappmywjhvsy.png" alt=" " width="588" height="77"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;querySelectorAll()&lt;/strong&gt; &lt;br&gt;
 This method returns the node list which is list of documents within page. You know that array is similar to Pill strip of fungal infection, and also contain the length property, index starts from 0, NodeList are iterable , they allow you to use for/of and you can also able to use the tradition for loop also.&lt;/p&gt;

&lt;p&gt;Pass NodeList to Array.form() method , and you will get a true array. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F6pkmb30k70yu7cd0dguj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F6pkmb30k70yu7cd0dguj.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fvnqldwqg543sp99kz9v9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvnqldwqg543sp99kz9v9.png" alt=" " width="758" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;** getElementsByClassName **&lt;br&gt;
 1-It will return all the elements which have class name for ex- "masterji"&lt;br&gt;
2- It returns group/ collection of html elements, which is also known as HTMLCollection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fvd8u9frpm6x0530ez2em.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvd8u9frpm6x0530ez2em.png" alt=" " width="772" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Difference between the NodeList and HtmlCollection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fc3j4pgr4zmxwyroc41r4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fc3j4pgr4zmxwyroc41r4.png" alt=" " width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>chaicode</category>
      <category>programming</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>The new Keyword in JavaScript</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Mon, 16 Mar 2026 05:16:54 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/the-new-keyword-in-javascript-3of3</link>
      <guid>https://dev.to/bhupeshchandrajoshi/the-new-keyword-in-javascript-3of3</guid>
      <description>&lt;p&gt;What the new keyword does?&lt;br&gt;
  New Keyword in JavaScript is a way to create object by intializing the object constructor. Let's visit blog practically, we can create , give name to objects and assign the properties to the object(your old friend- properties are just like jeans, belt ,shirt and you can assign a wearing Cloths function.)&lt;/p&gt;

&lt;p&gt;let girlFriend=null; // null because I don't have girlfriend.&lt;br&gt;
&lt;a href="https://media2.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%2Fnetpfxrxl2hxnhhmoasz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fnetpfxrxl2hxnhhmoasz.png" alt=" " width="800" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Constructor functions&lt;br&gt;
  why I have created small letter of assignProperty(girlfriend) function signature? Before jumping into this, let's visit what is constructor frist? constructor is a sepecial function that can initialize the object or adds values to key of an object. This time we will create new girlfriend / girlfriend should only one, but don't mind ,it's just a program and we will initilize ,girlfriend's properties here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fufkpoq4tvt6s35hi6yb6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fufkpoq4tvt6s35hi6yb6.png" alt=" " width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Object creation process&lt;/p&gt;

&lt;p&gt;We have two ways Object creation , the first will be object literal and second way we have discussed first. The object constuctor initialization.&lt;/p&gt;

&lt;p&gt;let student={}; &lt;/p&gt;

&lt;p&gt;// This is a way , and considered the best practice to create an object.&lt;/p&gt;

&lt;p&gt;How new links prototypes&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F5jqqilksvxphaip4x0x4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5jqqilksvxphaip4x0x4.png" alt=" " width="800" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you will be observe it clearly that prototype is just an object, that inherited from your in built constuctor from object class that provides the information about constructor. when you add a functionName.prototype.fullName="New function full name will be added";&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fyby5ndo4z4dtf861v368.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fyby5ndo4z4dtf861v368.png" alt=" " width="800" height="36"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instances created from constructors&lt;/p&gt;

&lt;p&gt;When we create a instance then we will inherit from Object.prototype, and even javaScript has ways to prevent prototype creation.&lt;/p&gt;

&lt;p&gt;1-Object.create(null) &lt;br&gt;
2-Object.freeze(Object.prototype) &lt;/p&gt;

</description>
      <category>chaicode</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>web3</category>
    </item>
    <item>
      <title>The Magic of this, call(), apply(), and bind() in JavaScript</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Thu, 12 Mar 2026 11:48:10 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/the-magic-of-this-call-apply-and-bind-in-javascript-2nf9</link>
      <guid>https://dev.to/bhupeshchandrajoshi/the-magic-of-this-call-apply-and-bind-in-javascript-2nf9</guid>
      <description>&lt;p&gt;What this means in JavaScript &lt;br&gt;
  You know that rumours are the mistruths which spread early and this keyword refers to the function it appears ,it is mistaken, The value of this determined dynamically(how it is invoked) , not on the function definition. If you want to understand this well, you&lt;/p&gt;

&lt;p&gt;The prototype mechanism is a look-up chain for properties and inheritance and this is related to prototype mechanism. The concept of fake classes arrived from the this mechanism, classes mimic the objects / functions. if you can create a object of a function, &lt;/p&gt;

&lt;p&gt;Authers said the desire to bring class and inheritance design pattern thinking to JavaScript is just about the worst thing you could try to do. The syntax can do a lot with you, you wonder that classes are present,classes are based on prototypal inheritance,it is considered as you are implementing the inheritance.&lt;/p&gt;

&lt;p&gt;You know about the behavior delegation. This is more than syntactic preference. Delegation is an entirely different, and more powerful, design pattern, one that replaces the need to design with classes and inheritance. I will explain what this means, it adds the prototype property on the object and instead of copying ,it leverages the principle of link, if you add a new property to the prototype, you can access it later.Learn and embrace how the object prototype system actually works. You need to understand the thinking of javaScript, the recommended inheritance is javaScript is prototype chaining for performance.&lt;/p&gt;

&lt;p&gt;Performance Considerations&lt;br&gt;
1-Memory Efficiency&lt;br&gt;
2-Property Lookup Time&lt;br&gt;
3-Optimization by Engines&lt;/p&gt;

&lt;p&gt;this inside normal functions&lt;br&gt;
JS Rule: We leverage this as window (global) object in normal function or undefined in Strict mode.&lt;/p&gt;

&lt;p&gt;This doesn't have any home,it can be anywhere.&lt;/p&gt;

&lt;p&gt;This inside object:&lt;br&gt;
When a function inside a object,in such case this points to that object.&lt;/p&gt;

&lt;p&gt;abhishek.speak(), means this is Abhishek this time. Let's consider, Abhishek,a groom in movie and he speaks i am looking handsome,&lt;br&gt;
So this is Abhishek and he is talking about himself.&lt;/p&gt;

&lt;p&gt;What call() does&lt;br&gt;
It depicts which actor will deliver the dialogues. We know about code borrowing and call method is just like object borrowing. It's method borrowing on inheritance,you must understand this by this image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ft8mt68n2x9qntkduq81x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ft8mt68n2x9qntkduq81x.png" alt=" " width="800" height="1777"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What apply() does&lt;br&gt;
 Apply() method leveraged for the changing the object associated with this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fx4kt5ta7tkl9owimfu7h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fx4kt5ta7tkl9owimfu7h.png" alt=" " width="747" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What bind() does&lt;br&gt;
 bind freezes the this to perticular object. So, you can't able to change the value of this by apply.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fiqoe8mjb96m413l57vzh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fiqoe8mjb96m413l57vzh.png" alt=" " width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>chaicode</category>
      <category>webdev</category>
      <category>programming</category>
      <category>basic</category>
    </item>
    <item>
      <title>At the Risk of Comparison a mobile blog on Operators.</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Thu, 12 Mar 2026 03:17:43 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/at-the-risk-of-comparison-a-mobile-blog-on-operators-3if6</link>
      <guid>https://dev.to/bhupeshchandrajoshi/at-the-risk-of-comparison-a-mobile-blog-on-operators-3if6</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.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%2Fsjcmqxrergg4n66n5edc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fsjcmqxrergg4n66n5edc.png" alt=" " width="800" height="1200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's start with pemdas rule of operator precedence &lt;/p&gt;

&lt;p&gt;Pemdas consists of Parentheses, Exponents, Multiplication and Division , Addition and Subtraction.&lt;/p&gt;

&lt;p&gt;All performed left to right,as you write English,hindi and coding,all are performed and written left to right.&lt;/p&gt;

&lt;p&gt;We will capable to remember this by formula "pemdas comparison logically".&lt;/p&gt;

&lt;p&gt;You are familiar with the BODMAS rule of the mathematics which assists javascript to decide for operator precedence.&lt;/p&gt;

&lt;p&gt;B deside the order  ( ), { }, [ ] which will resolve first and of play with power and exponents. &lt;/p&gt;

&lt;p&gt;D / M accomplished the left to right,&lt;br&gt;
A / M- Addition and Subtraction achieved left to right.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F86se9nf999knevjfb7yp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F86se9nf999knevjfb7yp.png" alt=" " width="800" height="1200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have covered Arithmetic operators (+, -, *, /, %) in terms of formula, which will be helpful, when you solve a problem of any programming languages and operators are same on every language.&lt;/p&gt;

&lt;p&gt;Comparison operators (==, ===, !=, &amp;gt;, &amp;lt;)&lt;/p&gt;

&lt;p&gt;The main difference between == and === .&lt;br&gt;
  == accomplishes type coercion (type conversion) ,when comparing values(let's compare notes , from the decorated office | space is true or false, how is ambience, it is just identical to the comparision operators), so values of different types may be considered equal after coercion. For example, 0 == false is true, "" == false is true,''=='' is true, and null == undefined is true. These are the famous bugs of javascript, people love these bugs and left them in JavaScript to make js backword compatible.&lt;/p&gt;

&lt;p&gt;The === operator tests stringent(strict) equality: it only returns true if both value and type are exactly the same, with no type coercion. For example, "" === false is false.&lt;/p&gt;

&lt;p&gt;The best practice recommends to influence yourself to leverage three-character operator === and !==). the reason when you want the types match.&lt;/p&gt;

&lt;p&gt;The === strict comparision operator doesn't perform the type coercion when compared, and compare arrays, functions, you will obtain the comparsion with help of their refernce.&lt;/p&gt;

&lt;p&gt;Reference vs. Value: array1 == array2 checks if they are the same instance (reference), not if they have the same elements.&lt;/p&gt;

&lt;p&gt;Memory Location: If two different arrays contain the same values, == will return false.&lt;br&gt;
&lt;a href="https://media2.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%2Fwwzpzk026uos4sqynhyk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwwzpzk026uos4sqynhyk.png" alt=" " width="800" height="131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;, &amp;lt; why they are made, money &amp;gt; respect or money &amp;lt; respect , we will use this example to make you understand, why these are leveraged and these logical operators deliver the boolean value. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tcc1pevm1rkqzicvwk9w.png" rel="noopener noreferrer"&gt;Image description&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Logical operators (&amp;amp;&amp;amp;, ||, !) &lt;br&gt;
  These concepts orignated from the digital electronics and these are backbone of computer science&lt;br&gt;
&lt;strong&gt;What does the Logical AND (&amp;amp;&amp;amp;) operator do?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Answer: It evaluates operands from left to right,just similar to moving left to right, returning the first falsy value it encounters. If all operands are truthy, it returns the last value.&lt;br&gt;
Example: console.log(" " &amp;amp;&amp;amp; true &amp;amp;&amp;amp; 10); // Returns 10&lt;/p&gt;

&lt;p&gt;What are the truthy and falsy values in JavaScript?&lt;br&gt;
Falsy Values are converted to zero / false ,when you are performing any logical operation.&lt;/p&gt;

&lt;p&gt;for example- &lt;/p&gt;

&lt;p&gt;false (the Boolean value itself)&lt;br&gt;
0, -0, and 0n (the number zero, negative zero, and BigInt zero)&lt;br&gt;
"", '', &lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 (an empty string)
null
undefined
NaN (Not a Number)
document.all (a legacy, deprecated object used for backward compatibility)

||- denoted as logical or operator and It returns the fist of two operands that is true.If the leftmost value is true, it returns that; otherwise, it returns the second value.It is often used to set default values.
console.log(null || "Hello");


Short-circuiting: It stops evaluation as soon as it finds the first truthy value.
Example:  -&amp;gt; result will be "Hello" because null is a falsy value.
Default value: let name = userInput || "Guest"; (If userInput is empty/undefined, "Guest" will be set). 

Truthy vs. Falsy Values:
In JavaScript, false, 0, "" (empty string), null, undefined, and NaN are considered 'falsy', while everything else is 'truthy'. 





Assignment operators (=, +=, -=)

Consider assignment is delegation a value or operation to a different variable.
apple=mango(Now apple and mango tastes similar sweet) ,

iceAge+=PipinghotEra is shortcut for iceAge=iceAge+PipinghotEra
,-=(it is also written similarly).


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>chaicode</category>
      <category>webdev</category>
      <category>typescript</category>
      <category>javascript</category>
    </item>
    <item>
      <title>The Heart of Node Js Architecture</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Wed, 11 Mar 2026 14:34:41 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/the-heart-of-node-js-architecture-5h6e</link>
      <guid>https://dev.to/bhupeshchandrajoshi/the-heart-of-node-js-architecture-5h6e</guid>
      <description>&lt;p&gt;To understand node js architecture, we need to understand the working of node js.&lt;br&gt;
Node Js Architecture describes the working of node js, how node js work, are you reading at office or home, fold your sleaves ang get ready for 3 min glimse.&lt;/p&gt;

&lt;p&gt;Node js is single threaded language and reactor pattern is heart of asychrononous in Node js.&lt;/p&gt;

&lt;p&gt;Asychronous is Non-blocking() ,you and your team will not stop you till plant a tree operation is successful, it's possible that your friend Abhishek has planted a tree and you are still digging the whole, you started parallelly, for example you are picking the customer info from database, the email operation will be start in parallel and it will run together the complex task will take time and easy one &lt;br&gt;
sending one email will be performed early.&lt;/p&gt;

&lt;p&gt;Reactor pattern represents the handler or callback to handle i/o operations. The callback will be invoked when an event processed by the event loop.&lt;/p&gt;

&lt;p&gt;There are a lot of misconceptions around the event loop of nodejs, and reactor pattern elaborated  about the event loop. &lt;/p&gt;

&lt;p&gt;1-We have a game developed with node js for example&lt;br&gt;
call of duty, it has names like james, who works on &lt;br&gt;
the army they have thier life too. When game(app) sends a i/o request to the handler and handler is part of event demultiplexer and handler returns the message to your application after affect from bumb, the health decrease message. When the i/o operation completes(In case of call of duty)- Gun Sound, hitting the target,missing the tarket and updating the health, capsule then increasing the health etc.&lt;/p&gt;

&lt;p&gt;2-Event demultiplexer has a hander (callback function), and event demultiplexer outsource the events into the&lt;br&gt;
event queue. The Event Loop iterates over((print)) the items of the Event Queue.&lt;/p&gt;

&lt;p&gt;When event queue is full, it blocks the event demultiplexer and event loop is performing the operation of event and associated handler from event&lt;br&gt;
loop parallelly when task is complete ,app sends the control back to event loop, app means call of duty game. You will understand more clearly with this diagram.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fxjmzoccang4rb0sus8k3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fxjmzoccang4rb0sus8k3.png" alt=" " width="800" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Libuv (the I/O engine of Node.js)-&lt;/p&gt;

&lt;p&gt;It is a pure c library and it's not a thread,and in order to simulate non-blocking behavior, it is necessary to use a separate thread outside the event loop.&lt;/p&gt;

&lt;p&gt;We have thread pool which is collection of pre created&lt;br&gt;
threads ,and parallel execution context (called runner) is additional thread, now node js breaks it's principle node js is a single threaded language.&lt;/p&gt;

&lt;p&gt;The reason to create libuv is Node.js compatible with all the major operating systems to provide os level async i/o. Libuv portrays the low-level&lt;br&gt;
I/O engine of Node.js and it is most imp component of&lt;br&gt;
node js.&lt;/p&gt;

&lt;p&gt;libuv also enacts the reactor pattern, it provides API for creating event loops,mananging the event queue, and running asynchronous I/O operations, and queuing other types of task.&lt;/p&gt;

&lt;p&gt;** Event loops**&lt;/p&gt;

&lt;p&gt;The responsibility of gathering events from the operating system or monitoring other sources of events is handled by libuv, and the user can register callbacks to be invoked when an event occurs. The event-loop usually keeps running&lt;br&gt;
forever. In pseudocode: you have seen a while true &lt;br&gt;
loop and loging on console runs always.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F3gm1h5djv42o7ah3fpcp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F3gm1h5djv42o7ah3fpcp.png" alt=" " width="800" height="114"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Google V8 Engine:&lt;/p&gt;

&lt;p&gt;It's javaScript runtime enviromment for executing the&lt;br&gt;
javaScript code from outside browser and inside server. It is orignally developed for google chrome by google team and that is the reason node js is fast.&lt;/p&gt;

&lt;p&gt;Who will help the v8 and libuv library to talk with each other, the answer is binding ,the code responsible for this purpose. An example is a binding for database libraries. &lt;br&gt;
V8 has no native understanding/cognition of databases, and database libraries don't care who uses them, so a binding is needed to make sure the two can talk to each other.&lt;/p&gt;

&lt;p&gt;V8 engine leverages the Just In Time(JIT) compilation pipeline design pattern to execute Js code that is the reason ,js is fast.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0nkx9q7xqyqpf70yo6s6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0nkx9q7xqyqpf70yo6s6.png" alt=" " width="741" height="625"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>chaicode</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>singlethreaded</category>
    </item>
    <item>
      <title>What are the advantages of Global and Global this:?</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Wed, 11 Mar 2026 07:40:19 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/what-are-the-advantages-of-global-and-global-this-1c51</link>
      <guid>https://dev.to/bhupeshchandrajoshi/what-are-the-advantages-of-global-and-global-this-1c51</guid>
      <description>&lt;p&gt;Global is the javascript keyword introduced when javascript was commenced. &lt;br&gt;
&lt;a href="https://media2.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%2F02olmf11j69r04coeja8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F02olmf11j69r04coeja8.png" alt=" " width="572" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These Global objects are present in all modules in javascript on backend(you can call them node js modules), we are discussing the backend , some of the objects which you are utilizing and experimenting on your coding, they arrived from node js.&lt;/p&gt;

&lt;p&gt;__dirname&lt;br&gt;
   You may be aware of this global variable, I don't this object this, we chat on instagram, facebook and the global means elders who can have access of your social media, same way this variale knows about your directory where you are executing your tasks.&lt;br&gt;
&lt;a href="https://media2.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%2Fb96ur0zx8km0dagvber9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fb96ur0zx8km0dagvber9.png" alt=" " width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;__filename *&lt;/em&gt;&lt;br&gt;
When we engaged in refactoring any project, we need to adopt the speed, in comparative mananage, if you console.log(__filename), you will understand,what was the difference from previous command on blog.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fz3l4yb4j1j6wcj0go22j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fz3l4yb4j1j6wcj0go22j.png" alt=" " width="800" height="365"&gt;&lt;/a&gt;&lt;br&gt;
exports-&lt;br&gt;
   We are fan of this varible who is our best friend when we performed the named export of our code. This is a OBJECT WHOSE INTITIAL VALUE IS EMPTY. &lt;br&gt;
&lt;a href="https://media2.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%2Fkd4idk7qxcayy2obyy6m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fkd4idk7qxcayy2obyy6m.png" alt=" " width="800" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you address the type of export , you will get console error and it is excelent may to maintain code functions and data into module,and then you will realize about the importance of this code,when you import your code in your project.&lt;br&gt;
console.log(typeof export)&lt;/p&gt;

&lt;p&gt;module-&lt;br&gt;
 Module is an object, because everything is object in javaScript, If you call ecma script developers,what they discuss about module, we dicussed about import and export, you know that import and exports are the module, we module our code in bundle,so that wood packet, we will be reuse, as require.&lt;/p&gt;

&lt;p&gt;require()-&lt;br&gt;
  it is an older way to import the node modules from the node js and it's common js way to import.&lt;/p&gt;

&lt;p&gt;It provides you the all the code files which require consist of, but if you are be aware of import keyword, you also grab the necessary code for your projects.&lt;/p&gt;

&lt;p&gt;Global This: &lt;br&gt;
  When you know the history of global this, the access to this object changed, now it's updated to arrived in ECMAScript 2020 , a single and easy way to access the golab object.&lt;br&gt;
&lt;a href="https://media2.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%2Ffl2aok7djmh7ipx9dyl3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffl2aok7djmh7ipx9dyl3.png" alt=" " width="800" height="616"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The modern way is quite simplified in es2020:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0iorgnw4sluwq03jzei3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0iorgnw4sluwq03jzei3.png" alt=" " width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>chaicode</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The Relationship Between TypeScript and JavaScript</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Mon, 09 Mar 2026 08:07:58 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/the-relationship-between-typescriptand-javascript-3fn9</link>
      <guid>https://dev.to/bhupeshchandrajoshi/the-relationship-between-typescriptand-javascript-3fn9</guid>
      <description>&lt;p&gt;You can consider javaScript is typescript without types, both are same, but difference , typescript adds additional syntax for specifying types. Let's understand the typescript.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F2olm9srvjx29oqqeiqq5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F2olm9srvjx29oqqeiqq5.png" alt=" " width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;what typescript has a type-checker? Yes,typescript type checker is a part of compiler and it checks the types of typescript and throws the error,if it doesn't find any types associated with it. Before converting your typescript code, type checker dances without and checks the type errors on the code.&lt;/p&gt;

&lt;p&gt;If you have a javacript code, you want to migrate it to typescript, you don't need to write the code again, just you need to change the extention and embedded the .ts or tsx extention at the end.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Who is the Seasoned JavaScript Developer</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Sun, 08 Mar 2026 05:20:54 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/who-is-the-seasoned-javascript-developer-3je9</link>
      <guid>https://dev.to/bhupeshchandrajoshi/who-is-the-seasoned-javascript-developer-3je9</guid>
      <description>&lt;p&gt;There are some key characteristics of a Seasoned javaScript developer.&lt;/p&gt;

&lt;p&gt;1-Focus on Fundamentals : focus on the trusted fundamental meaning ,a developer who reads lot of most recommended books in JavaScript ,for example ,you don't know js (six book series), at least every developer should read.&lt;/p&gt;

&lt;p&gt;2- Best Practices: How do you get the best practices and the answer is widely used best practices covered by chaicode youtube and the most read javaScript books, understanding the rabbit hole of a topic is quite important. &lt;/p&gt;

&lt;p&gt;3- Advanced Concepts: A seasoned developer must know concepts like closures , hoisting ,this and Asynchronous JavaScript(because JavaScript is single threaded, you writing the synchronous will be considered the bad practice).&lt;/p&gt;

&lt;p&gt;4- ALl seasoned developer asks why this imp? Before we jump into code, we should examine the thinking behind the problem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fk4jyyw0kiudkvklec60d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fk4jyyw0kiudkvklec60d.png" alt=" " width="691" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you don't know this ,you don't know the javaScript itself, when you pass a parameters ,the readiness of code decreased, so we pass this inside function.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Confused mechanism of JavaScript This &amp; Global [This]</title>
      <dc:creator>Bhupesh Chandra Joshi</dc:creator>
      <pubDate>Sun, 08 Mar 2026 04:22:28 +0000</pubDate>
      <link>https://dev.to/bhupeshchandrajoshi/confused-mechanism-of-javascript-this-global-this-3gpa</link>
      <guid>https://dev.to/bhupeshchandrajoshi/confused-mechanism-of-javascript-this-global-this-3gpa</guid>
      <description>&lt;p&gt;One of the most confused machanism of JavaScript is the this keyword. I don't need a local scope; I have global power and this context.this is my current context, but global is my playground.Why restrict yourself to one function? Use global to make this variable everyone's problem!.&lt;/p&gt;

&lt;p&gt;"Local variables stay in the closet, but global brings this variable to the party. "&lt;/p&gt;

&lt;p&gt;When feel thoughless or stuck a problem, search on social media, youtube ,and watch a video which will reset you to the global state. Global this is standard way to access global window object.&lt;/p&gt;

&lt;p&gt;You can define a global variable like this&lt;br&gt;
globalThis.party = "Feeling stuck,let's party and have a fun and enjoy with friends"   &lt;a class="mentioned-user" href="https://dev.to/piyushgargdev"&gt;@piyushgargdev&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This is a special identifier that's automatically defined in score of every person. for example we create a input field and this keyword is used to reference the form keyword. &lt;/p&gt;



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