<?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: Tejas Khanolkar</title>
    <description>The latest articles on DEV Community by Tejas Khanolkar (@tejas_khanolkar_473f3ed1a).</description>
    <link>https://dev.to/tejas_khanolkar_473f3ed1a</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%2F1529145%2F633fce16-5be7-4560-b7fc-439193b9a45c.png</url>
      <title>DEV Community: Tejas Khanolkar</title>
      <link>https://dev.to/tejas_khanolkar_473f3ed1a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tejas_khanolkar_473f3ed1a"/>
    <language>en</language>
    <item>
      <title>Synchronous and Asynchronous behavior of JavaScript</title>
      <dc:creator>Tejas Khanolkar</dc:creator>
      <pubDate>Fri, 05 Jun 2026 13:59:18 +0000</pubDate>
      <link>https://dev.to/tejas_khanolkar_473f3ed1a/synchronous-and-asynchronous-behavior-of-javascript-2cp1</link>
      <guid>https://dev.to/tejas_khanolkar_473f3ed1a/synchronous-and-asynchronous-behavior-of-javascript-2cp1</guid>
      <description>&lt;h2&gt;
  
  
  Synchronous Behavior of JavaScript
&lt;/h2&gt;

&lt;p&gt;Before understanding asynchronous JavaScript, we first need to understand synchronous behavior.&lt;/p&gt;

&lt;p&gt;Synchronous behavior means JavaScript executes code one statement at a time in the order in which it appears.&lt;/p&gt;

&lt;p&gt;Let's look at an 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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getRun&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;I am running&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="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;Hi&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I am doing work&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;getRun&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;Bye&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;&lt;strong&gt;Output:&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;Hi
I am doing work
I am running
Bye
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, JavaScript executes each statement one after another.&lt;/p&gt;

&lt;p&gt;It does not skip a statement and come back later. It finishes the current work before moving to the next one.&lt;/p&gt;

&lt;p&gt;This type of execution is called &lt;strong&gt;synchronous execution&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  JavaScript is Single-Threaded
&lt;/h2&gt;

&lt;p&gt;You may have heard that JavaScript is a single-threaded language.&lt;/p&gt;

&lt;p&gt;But what does that mean?&lt;/p&gt;

&lt;p&gt;A single-threaded language can perform only one task at a time.&lt;/p&gt;

&lt;p&gt;Consider the following code:&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;Program Start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 2&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;b&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="c1"&gt;// 3&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;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 4&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;Program End&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JavaScript executes the code in this order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 → 2 → 3 → 4 → 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It completes statement 1 before moving to statement 2.&lt;/p&gt;

&lt;p&gt;It completes statement 2 before moving to statement 3.&lt;/p&gt;

&lt;p&gt;This happens because JavaScript has only one main thread for executing code.&lt;/p&gt;

&lt;p&gt;So when we say JavaScript is single-threaded, we mean that it can execute only one task at a time.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Do We Need Asynchronous Behaviour?
&lt;/h2&gt;

&lt;p&gt;Imagine you click a button on a website.&lt;/p&gt;

&lt;p&gt;After clicking the button, the browser needs to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetch data from a server&lt;/li&gt;
&lt;li&gt;Wait for a timer&lt;/li&gt;
&lt;li&gt;Access the user's location&lt;/li&gt;
&lt;li&gt;Read data from local storage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some of these operations can take time.&lt;/p&gt;

&lt;p&gt;Now imagine JavaScript stopped everything and waited until those operations finished.&lt;/p&gt;

&lt;p&gt;The webpage would freeze.&lt;/p&gt;

&lt;p&gt;Buttons would stop responding.&lt;/p&gt;

&lt;p&gt;Animations would stop.&lt;/p&gt;

&lt;p&gt;The user experience would become poor.&lt;/p&gt;

&lt;p&gt;To avoid this problem, JavaScript uses asynchronous behavior.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Asynchronous Behaviour?
&lt;/h2&gt;

&lt;p&gt;Asynchronous behavior allows JavaScript to start a task that may take time and continue executing the remaining code without waiting for that task to finish.&lt;/p&gt;

&lt;p&gt;In other words, JavaScript does not block the execution of the rest of the program while waiting for certain operations to complete.&lt;/p&gt;

&lt;p&gt;Let's see an 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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&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;Run after 2 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;2000&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;Bye&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;Many beginners expect the output to be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hi
Run after 2 seconds
Bye
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the actual output is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hi
Bye
Run after 2 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why?
&lt;/h3&gt;

&lt;p&gt;Because JavaScript does not wait for the timer to finish.&lt;/p&gt;

&lt;p&gt;Instead, it continues executing the next statement.&lt;/p&gt;

&lt;p&gt;So &lt;code&gt;"Bye"&lt;/code&gt; gets printed immediately.&lt;/p&gt;

&lt;p&gt;After approximately 2 seconds, the callback function executes and prints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Run after 2 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What If the Delay Is 0?
&lt;/h2&gt;

&lt;p&gt;Let's change the timer value.&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;Hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&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;Run after 0 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;0&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;Bye&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;&lt;strong&gt;Output:&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;Hi
Bye
Run after 0 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Many developers are surprised by this.&lt;/p&gt;

&lt;p&gt;Even though the delay is 0 milliseconds, &lt;code&gt;"Bye"&lt;/code&gt; is still printed before the callback function.&lt;/p&gt;

&lt;p&gt;This shows that JavaScript does not execute the callback immediately.&lt;/p&gt;

&lt;p&gt;The callback is executed later.&lt;/p&gt;

&lt;p&gt;We will learn exactly how this happens in the next blog.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Does JavaScript Perform This Asynchronous Work?
&lt;/h2&gt;

&lt;p&gt;Operations such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Timers (&lt;code&gt;setTimeout&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;User interactions&lt;/li&gt;
&lt;li&gt;Network requests&lt;/li&gt;
&lt;li&gt;Location-related operations&lt;/li&gt;
&lt;li&gt;Local storage operations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;are not handled directly by the JavaScript engine.&lt;/p&gt;

&lt;p&gt;The browser provides special features that help perform these tasks.&lt;/p&gt;

&lt;p&gt;When JavaScript encounters such work, it can hand over that responsibility and continue executing the remaining code.&lt;/p&gt;

&lt;p&gt;Once that work is completed, JavaScript gets notified and can execute the corresponding callback function.&lt;/p&gt;

&lt;p&gt;The complete internal process behind this behavior will be discussed in the next blog.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Synchronous execution means code runs one statement after another.&lt;/li&gt;
&lt;li&gt;JavaScript is single-threaded, meaning it executes one task at a time.&lt;/li&gt;
&lt;li&gt;Some operations take time to complete.&lt;/li&gt;
&lt;li&gt;Waiting for such operations would make the webpage unresponsive.&lt;/li&gt;
&lt;li&gt;Asynchronous behavior allows JavaScript to continue running other code while those operations are being handled.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setTimeout()&lt;/code&gt; is a simple example of asynchronous behavior.&lt;/li&gt;
&lt;li&gt;In the next blog, we will learn how JavaScript actually manages asynchronous tasks behind the scenes.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>calculator using html,css and js</title>
      <dc:creator>Tejas Khanolkar</dc:creator>
      <pubDate>Sun, 12 Oct 2025 19:05:35 +0000</pubDate>
      <link>https://dev.to/tejas_khanolkar_473f3ed1a/calculator-using-htmlcss-and-js-1k7e</link>
      <guid>https://dev.to/tejas_khanolkar_473f3ed1a/calculator-using-htmlcss-and-js-1k7e</guid>
      <description>&lt;h1&gt;
  
  
  Creating a Calculator Application using HTML, CSS, and JavaScript
&lt;/h1&gt;

&lt;p&gt;In this guide, I’ll walk you through how I built a simple &lt;strong&gt;calculator web application&lt;/strong&gt; using &lt;strong&gt;HTML&lt;/strong&gt;, &lt;strong&gt;CSS&lt;/strong&gt;, and &lt;strong&gt;JavaScript&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This project helped me understand how the &lt;strong&gt;Document Object Model (DOM)&lt;/strong&gt; works, how to &lt;strong&gt;validate expressions using regular expressions (regex)&lt;/strong&gt;, and how to handle user input dynamically through JavaScript events.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧰 Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before starting, you should have basic knowledge of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML structure and elements&lt;/li&gt;
&lt;li&gt;CSS for basic styling&lt;/li&gt;
&lt;li&gt;JavaScript fundamentals (variables, functions, event listeners)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re new to JavaScript, don’t worry — this project is simple and a great way to learn DOM manipulation and regex usage.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 What You’ll Learn
&lt;/h2&gt;

&lt;p&gt;By the end of this project, you’ll understand:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How to access and modify HTML elements using the &lt;strong&gt;DOM&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;How to validate arithmetic expressions using &lt;strong&gt;regular expressions (regex)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;How to respond to user interactions (button clicks).&lt;/li&gt;
&lt;li&gt;How to evaluate user input dynamically using JavaScript’s &lt;strong&gt;&lt;code&gt;eval()&lt;/code&gt;&lt;/strong&gt; function.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🏗️ About the Project
&lt;/h2&gt;

&lt;p&gt;This calculator is a simple, single-page web application that performs basic arithmetic operations such as addition, subtraction, multiplication, division, and modulus.&lt;/p&gt;

&lt;p&gt;For the UI (User Interface), I used a pre-made &lt;strong&gt;HTML and CSS&lt;/strong&gt; template.&lt;br&gt;
My main focus was on writing the &lt;strong&gt;JavaScript logic&lt;/strong&gt; to make the calculator actually work.&lt;/p&gt;


&lt;h2&gt;
  
  
  🌐 Understanding the DOM
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Document Object Model (DOM)&lt;/strong&gt; represents your HTML page as a tree of elements that JavaScript can interact with.&lt;/p&gt;

&lt;p&gt;Using the DOM, we can &lt;strong&gt;grab elements&lt;/strong&gt;, &lt;strong&gt;update content&lt;/strong&gt;, or &lt;strong&gt;change styles&lt;/strong&gt; based on user actions.&lt;/p&gt;

&lt;p&gt;Common DOM methods I used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;document.getElementById()&lt;/code&gt;&lt;/strong&gt; – grabs an element by its unique ID.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;document.querySelector()&lt;/code&gt;&lt;/strong&gt; – grabs the first element matching a CSS selector.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;document.querySelectorAll()&lt;/code&gt;&lt;/strong&gt; – grabs all elements matching a CSS selector.&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="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;display&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerText&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 World&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;&lt;a href="https://68ebfb17889a4624d3d11eca--vermillion-beignet-f46493.netlify.app/" rel="noopener noreferrer"&gt;click here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day 1: Defining Variables in JavaScript</title>
      <dc:creator>Tejas Khanolkar</dc:creator>
      <pubDate>Sat, 13 Jul 2024 22:01:51 +0000</pubDate>
      <link>https://dev.to/tejas_khanolkar_473f3ed1a/day-1-defining-variables-in-javascript-4719</link>
      <guid>https://dev.to/tejas_khanolkar_473f3ed1a/day-1-defining-variables-in-javascript-4719</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;I’ve started Hitesh Sir’s JavaScript 30 days challenge, and today’s task was all about defining variables and understanding their types. If you haven't joined yet, you can check it out &lt;a href="https://courses.chaicode.com/learn/batch/30-days-of-Javascript-challenge" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Hurry, it's free until July 14th!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Declaring Variables
&lt;/h2&gt;

&lt;p&gt;In JavaScript, you can declare variables using three keywords: let, var, and const. Here’s a quick overview:&lt;/p&gt;

&lt;p&gt;let: Allows you to declare a variable that can be changed later.&lt;br&gt;
var: Similar to let, but has some differences in scope handling.&lt;br&gt;
const: Used to declare variables that should not be changed.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let myVariable = 'Hello';
var myOldVariable = 'World';
const myConstant = 42;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you use let or var, you can change the value of the variable. However, if you declare a variable with const, attempting to change its value will result in an error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Variable Types
&lt;/h2&gt;

&lt;p&gt;You can assign various types of values to variables:&lt;br&gt;
&lt;strong&gt;Number&lt;/strong&gt;: For numerical values.&lt;br&gt;
&lt;strong&gt;String&lt;/strong&gt;: For text values.&lt;br&gt;
&lt;strong&gt;Boolean&lt;/strong&gt;: For true/false values.&lt;br&gt;
&lt;strong&gt;undefined&lt;/strong&gt;: For variables that are declared but not yet assigned a value.&lt;br&gt;
&lt;strong&gt;null&lt;/strong&gt;: For variables explicitly set to have no value.&lt;br&gt;
These are called primitive values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br&gt;
The syntax for declaring a variable is straightforward:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let/const/var variableName = value;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Think of a variable as a box, and the value as the content inside the box.&lt;/p&gt;
&lt;h2&gt;
  
  
  Key Points
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;typeof&lt;/strong&gt;: This is an operator, not a function. It’s used to check the type of a variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(typeof myVariable); // Output: string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;console.table&lt;/strong&gt;: Handy for displaying arrays and objects in a tabular format.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ['Apple', 'Banana', 'Cherry'];
console.table(fruits);

const user = {
  name: 'John',
  age: 25,
  city: 'New York'
};
console.table(user);

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Research Findings on Variable Declarations
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;I found an excellent resource on variable declarations at  &lt;a href="https://JavaScript.info" rel="noopener noreferrer"&gt;javascriptInfo&lt;/a&gt;. Here’s a summary of what I learned:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Difference between var and let:&lt;/strong&gt; They are almost the same, but their scope handling is different. let is block-scoped while var is function-scoped.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Naming constants:&lt;/strong&gt; Use uppercase letters for constant variable names if their values are already known. Otherwise, use camelCase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Redeclaration:&lt;/strong&gt;  You cannot declare the same variable again using let or var, but you can change its value multiple times (except for const variables).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Naming conventions:&lt;/strong&gt; Variable names should preferably be in camelCase (though it's not strictly required).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Declaring multiple variables:&lt;/strong&gt; It's better to declare multiple variables on separate lines for readability.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let user = 'John';
let age = 25;
let message = 'Hello';
&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 plaintext"&gt;&lt;code&gt;let user = 'John', age = 25, message = 'Hello';

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Meaningful names:&lt;/strong&gt; Always give meaningful names to your variables.
For more detailed information, you can follow &lt;a href="https://JavaScript.info/variables" rel="noopener noreferrer"&gt;this&lt;/a&gt;blog article.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feel free to tweak this further as per your style. Happy coding!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Mastering Django: A Workflow Guide</title>
      <dc:creator>Tejas Khanolkar</dc:creator>
      <pubDate>Tue, 09 Jul 2024 21:29:39 +0000</pubDate>
      <link>https://dev.to/tejas_khanolkar_473f3ed1a/mastering-django-a-workflow-guide-mdm</link>
      <guid>https://dev.to/tejas_khanolkar_473f3ed1a/mastering-django-a-workflow-guide-mdm</guid>
      <description>&lt;h2&gt;
  
  
  Understanding the Django Framework: A Deep Dive into its Working Flow
&lt;/h2&gt;

&lt;p&gt;Django is a full-stack framework created in Python. To understand Django, it’s essential first to grasp the concept of a framework. A framework is the structure or skeleton of your application. It provides a basic foundation upon which you build your application. When developing an app using a framework, you must adhere to its rules and conventions. These rules are strict to ensure your application runs smoothly in a production environment. Official documentation for each framework is available to guide you in creating applications that comply with these rules.&lt;/p&gt;

&lt;p&gt;Django has its own flow structure, which you must follow to inject your code correctly. Deviating from this structure can lead to errors and issues. Let’s delve into the main topic and understand the working flow of the Django framework.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx4oyihpyv899cj7lj3u7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx4oyihpyv899cj7lj3u7.jpg" alt="working flow of django-framework" width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Request Handling in Django
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;User Request: The process begins when a user sends a request to the server. In this context, the server is the Django server. &lt;/li&gt;
&lt;li&gt;URL Resolver: The Django server catches the request and passes it to the URL resolver, a private file in Django that developers do not have access to. This file resolves the URL and forwards the request to the urls.py file, where the routes are mapped to views.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Understanding Views and MVT Architecture
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;URL Mapping: In the urls.py file, the URL resolver checks which route is mapped to which view and sends the request to the corresponding view function in the views.py file. &lt;/li&gt;
&lt;li&gt;Views: In Django, a view is a function that takes a request as an argument and returns a response to the client. To fully understand views, you need to understand the MVT architecture that Django follows. MVT stands for Model, View, Template. In this architecture, the view acts as a communicator between models and templates.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Interaction with Models
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Model Interaction: Based on the nature of the request, the view may interact with models. A model in Django represents a table in the database. While you could interact directly with the database, Django provides a way to interact with it through models, which offer an abstract layer. This abstraction allows you to change the database with a single setting without interrupting the rest of the code.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Returning the Response
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Template Rendering: After interacting with the model, control returns to the view, which then searches for the appropriate template to return to the client. Templates in Django are specific folders containing HTML files. These HTML files are called templates because their content is dynamic, changing with the help of the Jinja template engine. Jinja allows you to inject logic into your HTML files, making them dynamic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Response: After rendering the template, the controller (in this case, the view) prepares the final response and sends it back to the user (client).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This is the overall workflow of a Django application. From receiving a request to returning a response, Django’s structure ensures a streamlined process that adheres to its MVT architecture. By following this flow, developers can create robust and scalable web applications efficiently.&lt;/p&gt;

</description>
      <category>chaiaurcode</category>
      <category>python</category>
      <category>django</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
