<?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: Dhanushkumar</title>
    <description>The latest articles on DEV Community by Dhanushkumar (@dhanush_kumar).</description>
    <link>https://dev.to/dhanush_kumar</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%2F3216165%2Ff6512b4f-eefd-411d-b792-be8c5401a3fd.jpg</url>
      <title>DEV Community: Dhanushkumar</title>
      <link>https://dev.to/dhanush_kumar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhanush_kumar"/>
    <language>en</language>
    <item>
      <title>A Comprehensive Guide to ReactDOM, JSX, SPA vs MPA, npm &amp; npx, Hooks</title>
      <dc:creator>Dhanushkumar</dc:creator>
      <pubDate>Fri, 13 Jun 2025 18:24:57 +0000</pubDate>
      <link>https://dev.to/dhanush_kumar/a-comprehensive-guide-to-reactdom-jsx-spa-vs-mpa-npm-npx-hooks-5fjj</link>
      <guid>https://dev.to/dhanush_kumar/a-comprehensive-guide-to-reactdom-jsx-spa-vs-mpa-npm-npx-hooks-5fjj</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;1.React DOM&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What is React DOM?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;React DOM is the bridge between your React components and the actual browser DOM (Document Object Model). It allows your React code (written in JSX and JavaScript) to be displayed in the browser.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Why do we use it?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;React uses a virtual DOM for better performance. Instead of updating the entire web page every time something changes, React compares the new virtual DOM with the previous one and updates only the changed elements in the real DOM using React DOM. This process is called reconciliation and makes React fast and efficient.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;When is React DOM used?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;React DOM is used when you want to render your React components into the browser. Usually, this happens in your index.js file, where the main component (like ) is mounted to a real HTML element.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Where is it used?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is used in web projects. For React Native (for mobile apps), React DOM is replaced with React Native modules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How is it used?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s a basic example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(&amp;lt;App /&amp;gt;, document.getElementById('root'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In React 18+, the syntax slightly changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createRoot } from 'react-dom/client';
const root = createRoot(document.getElementById('root'));
root.render(&amp;lt;App /&amp;gt;);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;2. SPA vs MPA&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What are SPA and MPA?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;SPA&lt;/em&gt; (Single Page Application) loads one HTML file and updates the content dynamically using JavaScript without refreshing the page.&lt;br&gt;
&lt;em&gt;MPA&lt;/em&gt; (Multi Page Application) loads a new HTML page from the server each time the user navigates to a new route.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Why are they important?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SPAs offer a fast, seamless user experience by reducing load time and transitions. On the other hand, MPAs are better for SEO (Search Engine Optimization) and are often used for large websites like e-commerce or blogs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;When should you use them?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use SPA for dynamic web apps like dashboards, social platforms, or productivity tools. Use MPA for static websites or sites where SEO is critical.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Where are they used?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;SPAs:&lt;/strong&gt;&lt;/em&gt; React, Angular, Vue.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;MPAs:&lt;/strong&gt;&lt;/em&gt; Traditional HTML, PHP, JSP, and frameworks like Spring MVC or Laravel.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;3. npm vs npx&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What is npm and npx?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;npm (Node Package Manager)&lt;/em&gt; is a tool to install, manage, and share JavaScript packages.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;npx (Node Package Executer)&lt;/em&gt; is a tool to run npm packages without installing them permanently.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Why are they important?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With npm, you can install libraries like React, Axios, or Lodash. npx helps when you want to run tools (like &lt;code&gt;create-react-app&lt;/code&gt;) just once, without keeping them in your system.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;When are they used?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use npm when you want a package available in your project repeatedly. Use npx when you want to run a package only once, like setting up a new React project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Where are they used?&lt;/strong&gt;
They are used in your command line or terminal inside the project directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;How are they used?&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
To install Axios using npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To create a React app using npx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;4. JSX (JavaScript XML)&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What is JSX?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JSX is a syntax extension that lets you write HTML-like code inside JavaScript. It makes your React components more readable and intuitive.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Why do we use JSX?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JSX is easier to understand and write compared to plain JavaScript. Instead of calling functions like &lt;code&gt;React.createElement()&lt;/code&gt;, JSX allows you to visually structure UI like HTML.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;When should you use JSX?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whenever you want to build UI components in React. JSX is used inside functional or class components.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Where is it used?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Inside &lt;code&gt;.js&lt;/code&gt; or &lt;code&gt;.jsx&lt;/code&gt;files in your React app.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;How does JSX work?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JSX gets compiled into JavaScript behind the scenes. This:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const element = &amp;lt;h1&amp;gt;Hello, world!&amp;lt;/h1&amp;gt;;

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

&lt;/div&gt;



&lt;p&gt;Turns into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const element = React.createElement('h1', null, 'Hello, world!');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;5. Library vs Framework&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What is the difference?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A library is a collection of functions and tools you can use in your code (like React).&lt;/p&gt;

&lt;p&gt;A framework provides a complete structure and decides how your app is built and runs (like Angular).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Why does it matter?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Libraries offer flexibility. Frameworks offer structure. Depending on your needs, you may prefer one over the other.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;When to choose which?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use a library like React if you want control and customization. Use a framework like Angular if you want a pre-defined way to build applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Where are they used?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;React (library) is used in lightweight front-end apps. Angular (framework) is used in enterprise-grade apps needing built-in tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;6. Conditional Rendering in React&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What is it?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Conditional rendering means showing or hiding UI elements based on certain conditions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Why is it needed?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your app often needs to show different content for different users or states — like showing a login form if the user isn’t logged in.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;When do we use it?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whenever you need to change the UI based on data, props, or user interaction.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Where is it written?&lt;/strong&gt;
Inside JSX, often within a return statement of a component.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;7. How Hooks Work in React&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What are Hooks?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hooks are built-in React functions that let you use state and lifecycle features inside functional components.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Why were hooks introduced?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before hooks, only class components could use features like state and lifecycle methods. Hooks allow you to write simpler and reusable functional components.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;When are they used?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use useState() when you need local component state. Use useEffect() when you want to run side effects like API calls.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Where are hooks used?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only inside functional components — not in regular functions or class components.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>JavaScript Basics: Everything You Need to Know to Get Started</title>
      <dc:creator>Dhanushkumar</dc:creator>
      <pubDate>Wed, 28 May 2025 02:32:14 +0000</pubDate>
      <link>https://dev.to/dhanush_kumar/javascript-basics-everything-you-need-to-know-to-get-started-457n</link>
      <guid>https://dev.to/dhanush_kumar/javascript-basics-everything-you-need-to-know-to-get-started-457n</guid>
      <description>&lt;p&gt;JavaScript powers the dynamic behavior of modern websites and applications. Whether you're building interfaces, handling user interactions, or processing data, a strong grasp of JavaScript fundamentals is crucial. This guide walks through key concepts including &lt;strong&gt;data types, variables, functions, return values, arguments, function calls&lt;/strong&gt;, and &lt;strong&gt;string concatenation&lt;/strong&gt;—essential tools for writing robust and efficient JavaScript code.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔢 1. Data Types in JavaScript
&lt;/h2&gt;

&lt;p&gt;JavaScript provides a variety of data types to represent different kinds of information. Understanding these helps you choose the right type for your task.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;String&lt;/strong&gt;: Used to represent textual data. Strings are enclosed in single (&lt;code&gt;'&lt;/code&gt;) or double (&lt;code&gt;"&lt;/code&gt;) quotes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Number&lt;/strong&gt;: Represents both integer and floating-point numbers. JavaScript does not distinguish between them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Boolean&lt;/strong&gt;: Represents logical values, either &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;, commonly used in conditional statements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Null&lt;/strong&gt;: Represents the intentional absence of any object value. It must be assigned explicitly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Undefined&lt;/strong&gt;: A variable that has been declared but not assigned a value.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Object&lt;/strong&gt;: A complex data type used to store collections of data and more complex entities.&lt;/li&gt;
&lt;/ul&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;let&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;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;       &lt;span class="c1"&gt;// String&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;             &lt;span class="c1"&gt;// Number&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;isActive&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;      &lt;span class="c1"&gt;// Boolean&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;          &lt;span class="c1"&gt;// Null&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                &lt;span class="c1"&gt;// Undefined&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt; &lt;span class="c1"&gt;// Object&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🏷️ 2. Variables
&lt;/h2&gt;

&lt;p&gt;Variables are used to store data that your program can manipulate. In modern JavaScript, use &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; instead of &lt;code&gt;var&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;let&lt;/code&gt;&lt;/strong&gt;: Used when the variable’s value might change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;const&lt;/code&gt;&lt;/strong&gt;: Used when the variable should not be reassigned.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Variables must start with a letter, underscore &lt;code&gt;_&lt;/code&gt;, or dollar sign &lt;code&gt;$&lt;/code&gt;, and cannot begin with a number.&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;let&lt;/span&gt; &lt;span class="nx"&gt;city&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;New York&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;city&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Los Angeles&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Allowed&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;country&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;USA&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// country = "Canada"; // This would cause an error&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🧱 3. Functions
&lt;/h2&gt;

&lt;p&gt;Functions are reusable blocks of code that perform a specific task. They help structure your code, make it reusable, and separate concerns.&lt;/p&gt;

&lt;p&gt;There are different ways to define functions:&lt;/p&gt;

&lt;h3&gt;
  
  
  Function Declaration:
&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;function&lt;/span&gt; &lt;span class="nf"&gt;greet&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;Welcome to JavaScript!&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;h3&gt;
  
  
  Function Expression:
&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;greet&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;Welcome to JavaScript!&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;h3&gt;
  
  
  Arrow Function (ES6):
&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;greet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&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="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;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You call (or invoke) a function by writing its name followed by parentheses.&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;greet&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔄 4. Return Statement
&lt;/h2&gt;

&lt;p&gt;A function can use the &lt;code&gt;return&lt;/code&gt; statement to send a value back to the place where it was called. This allows functions to produce output and interact with other parts of the program.&lt;/p&gt;

&lt;p&gt;If there is no &lt;code&gt;return&lt;/code&gt; statement, the function returns &lt;code&gt;undefined&lt;/code&gt; by default.&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;function&lt;/span&gt; &lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&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="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// result = 20&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;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: 20&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🎯 5. Function Arguments
&lt;/h2&gt;

&lt;p&gt;Arguments are values you pass to a function when calling it. Functions can accept any number of arguments, and these are treated like local variables inside the function.&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;function&lt;/span&gt; &lt;span class="nf"&gt;welcomeUser&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="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, &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;!&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="nf"&gt;welcomeUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Daniel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: Hello, Daniel!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use default values for arguments:&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;welcomeUser&lt;/span&gt;&lt;span class="p"&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;Guest&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;Hello, &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;!&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="nf"&gt;welcomeUser&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: Hello, Guest!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔁 6. Function Calling
&lt;/h2&gt;

&lt;p&gt;To execute the code inside a function, you call it using its name followed by parentheses. You can pass arguments inside the parentheses.&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;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&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="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="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// sum = 25&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;sum&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: 25&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Functions can also be called from within other functions, enabling more complex operations.&lt;/p&gt;




&lt;h2&gt;
  
  
  ➕ 7. String Concatenation
&lt;/h2&gt;

&lt;p&gt;String concatenation means joining two or more strings together.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using &lt;code&gt;+&lt;/code&gt; Operator:
&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;firstName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;lastName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Doe&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;fullName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;firstName&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="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;lastName&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;fullName&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: John Doe&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Template literals are enclosed by backticks (&lt;code&gt;`&lt;/code&gt;) and allow embedded expressions using &lt;code&gt;${}&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&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;firstName&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;lastName&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;greeting&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs: Hello, John Doe!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






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

&lt;p&gt;Mastering JavaScript fundamentals such as data types, variables, functions, return values, arguments, and string manipulation lays the groundwork for becoming a proficient developer. These concepts are not just academic—they're used daily in real-world web development.&lt;/p&gt;

&lt;p&gt;Practice regularly by creating small scripts, experimenting with functions, and manipulating data. Each step brings you closer to building interactive and dynamic applications.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
