<?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>Forem: Deva I</title>
    <description>The latest articles on Forem by Deva I (@deva_i_932c8869ada96d4c9f).</description>
    <link>https://forem.com/deva_i_932c8869ada96d4c9f</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%2F3798144%2F9feab75e-fc8a-4f36-a8cd-6991d3e43de5.png</url>
      <title>Forem: Deva I</title>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/deva_i_932c8869ada96d4c9f"/>
    <language>en</language>
    <item>
      <title>Basic about react components,Jsx rules, React folder structure</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Thu, 14 May 2026 14:27:28 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/basic-about-react-componentsjsx-rules-react-folder-structure-and-spa-vs-mpa-ep8</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/basic-about-react-componentsjsx-rules-react-folder-structure-and-spa-vs-mpa-ep8</guid>
      <description>&lt;h2&gt;
  
  
  React components :
&lt;/h2&gt;

&lt;p&gt;◾Components are like functions that return HTML elements.&lt;/p&gt;

&lt;p&gt;◾Components are independent and reusable bits of code. They serve the same purpose as JavaScript functions, but work in isolation and return HTML.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key characteristics :
&lt;/h2&gt;

&lt;p&gt;🔹Reusability: You can write a component once (e.g., a Button or Header) and use it multiple times throughout your application.&lt;/p&gt;

&lt;p&gt;🔹Independent Logic: Each component manages its own logic, such as handling clicks or data.&lt;/p&gt;

&lt;p&gt;🔹Composable: You can nest components inside other components to build complex interfaces from simple parts.&lt;/p&gt;

&lt;p&gt;🔹Naming: component names must start with an uppercase letter to distinguish them from standard HTML tags.&lt;/p&gt;

&lt;p&gt;🔹They are two types &lt;br&gt;
1.class components &lt;br&gt;
2.functional components &lt;/p&gt;

&lt;p&gt;Class components :&lt;/p&gt;

&lt;p&gt;▪️It is the older version and this not recommended for new projects.&lt;/p&gt;

&lt;p&gt;functional components :&lt;/p&gt;

&lt;p&gt;▪️Simple JavaScript functions that return JSX. They are the modern standard because they are easier to read and use Hooks to manage state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Welcome&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello, world!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Jsx rules :
&lt;/h2&gt;

&lt;p&gt;◾JSX (JavaScript XML) is a syntax extension for JavaScript used in React to describe what the UI should look like.&lt;/p&gt;

&lt;p&gt;◾It follows specific rules they are,&lt;/p&gt;

&lt;p&gt;▪️Return a Single Root Element:  A component must return only one top-level element.If you need to return multiple elements use &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; or a React Fragment &lt;code&gt;(&amp;lt;&amp;gt;...&amp;lt;/&amp;gt;)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;▪️Close All Tags: Unlike HTML, every tag must be closed. This includes self-closing tags for elements without children, such as &lt;code&gt;&amp;lt;img /&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;br /&amp;gt;&lt;/code&gt;, and &lt;code&gt;&amp;lt;input /&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;▪️Use camelCase for Attributes.&lt;br&gt;
    🔹Use&lt;code&gt;className&lt;/code&gt;instead of &lt;code&gt;class&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🔹Use `htmlFor` instead of for

🔹Use event handlers like `onClick` instead of `onclick`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;▪️Embed JavaScript with Curly Braces.&lt;/p&gt;

&lt;p&gt;▪️Capitalize Component Names: React treats lowercase tags (like &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;) as built-in HTML elements. Custom components must start with a capital letter (e.g., &lt;code&gt;&amp;lt;MyComponent /&amp;gt;&lt;/code&gt;) to be recognized as React components.&lt;/p&gt;

&lt;h2&gt;
  
  
  React folder structure :
&lt;/h2&gt;

&lt;p&gt;When you first create a project with tools like Vite or Create React App, the root directory contains:&lt;/p&gt;

&lt;p&gt;🔹&lt;code&gt;public/&lt;/code&gt;: Static assets like &lt;code&gt;index.html&lt;/code&gt;, favicons, and the &lt;code&gt;manifest.json&lt;/code&gt;file.&lt;/p&gt;

&lt;p&gt;🔹&lt;code&gt;src/&lt;/code&gt;: The main development folder where all your React code lives.&lt;/p&gt;

&lt;p&gt;🔹&lt;code&gt;App.js&lt;/code&gt;: The root component of your application.&lt;/p&gt;

&lt;p&gt;🔹&lt;code&gt;index.js&lt;/code&gt;/&lt;code&gt;main.jsx&lt;/code&gt;: The entry point that renders the React app into the DOM.&lt;/p&gt;

&lt;p&gt;🔹&lt;code&gt;node_modules/&lt;/code&gt;: Contains all installed project dependencies.&lt;/p&gt;

&lt;p&gt;🔹&lt;code&gt;package.json&lt;/code&gt;: Lists your project dependencies and scripts.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>react</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>What is React and React build tools, Difference Between library vs frameworks.</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Wed, 13 May 2026 16:22:20 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/what-is-react-and-react-build-tools-difference-between-library-vs-frameworks-2k46</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/what-is-react-and-react-build-tools-difference-between-library-vs-frameworks-2k46</guid>
      <description>&lt;h2&gt;
  
  
  What is React :
&lt;/h2&gt;

&lt;p&gt;React is a popular, open-source JavaScript library used for building user interfaces (UIs), specifically for single-page applications where data changes over time without reloading the page.&lt;/p&gt;

&lt;p&gt;React developed and maintained by Meta (Facebook).&lt;/p&gt;

&lt;p&gt;It is widely used for creating fast and scalable single-page applications (SPAs).&lt;/p&gt;

&lt;p&gt;It allows developers to create large web applications that are fast, scalable, and simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Library :
&lt;/h2&gt;

&lt;p&gt;A Library is a set of code that was previously written by a developer that you can call when you are building your project.&lt;/p&gt;

&lt;p&gt;In Library, you import or call specific methods that you need for your project.&lt;/p&gt;

&lt;p&gt;In simple words, a bunch of code packed together that can be used repeatedly is known as Library.&lt;/p&gt;

&lt;p&gt;Reusability is one of the main reasons to use libraries.&lt;/p&gt;

&lt;p&gt;Some common examples of libraries are;&lt;/p&gt;

&lt;p&gt;▪️React&lt;/p&gt;

&lt;p&gt;React is a JavaScript library for building user interfaces.&lt;/p&gt;

&lt;p&gt;▪️Redux&lt;/p&gt;

&lt;p&gt;Redux is an open-source JavaScript library for managing application state.&lt;br&gt;
It's most commonly used with React&lt;/p&gt;

&lt;p&gt;▪️Three.js&lt;/p&gt;

&lt;p&gt;It's another super cool JavaScript library used to create and display 3d computer graphics.&lt;/p&gt;

&lt;p&gt;▪️Lodash&lt;/p&gt;

&lt;p&gt;Lodash is a JavaScript library that provides utility functions for common programming tasks.&lt;/p&gt;

&lt;p&gt;It's more of a productivity kit in node.js&lt;/p&gt;

&lt;p&gt;▪️jQuery&lt;/p&gt;

&lt;p&gt;jQuery is a JavaScript library that does the things like event handling and HTML document manipulation&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Framework :
&lt;/h2&gt;

&lt;p&gt;A framework is a supporting structure that gives shape to your code.&lt;/p&gt;

&lt;p&gt;In the Framework, you have to fill the structure accordingly with your code.&lt;/p&gt;

&lt;p&gt;There is a specific structure for a particular framework that you have to follow, and it's generally more restrictive than Library.&lt;/p&gt;

&lt;p&gt;One thing to remember here is that frameworks sometimes get quite large, so they may also use the Library.&lt;/p&gt;

&lt;p&gt;But the Framework doesn't necessarily have to use Library.&lt;/p&gt;

&lt;p&gt;Some common examples of frameworks are&lt;/p&gt;

&lt;p&gt;▪️Angular&lt;/p&gt;

&lt;p&gt;Angular is a JavaScript framework for web and mobile development.&lt;/p&gt;

&lt;p&gt;▪️Django&lt;/p&gt;

&lt;p&gt;Django is a fully featured server-side web framework written in&lt;br&gt;
Python.&lt;/p&gt;

&lt;p&gt;▪️Express&lt;/p&gt;

&lt;p&gt;Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.&lt;/p&gt;

&lt;p&gt;▪️Rails&lt;/p&gt;

&lt;p&gt;Rails is a web application development framework written in the Ruby programming language.&lt;/p&gt;

&lt;p&gt;▪️Spring&lt;/p&gt;

&lt;p&gt;Spring Framework is an open-source framework for building web applications with Java as a programming language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key difference between library and frameworks :
&lt;/h2&gt;

&lt;p&gt;The main key difference between the Library and Framework is something known as inversion of control.&lt;/p&gt;

&lt;p&gt;Let's understand this inversion of control more in detail.&lt;/p&gt;

&lt;p&gt;When you import a library, you have to call the specific methods or functions of your choice so, and it's up to you when and where to call the Library.&lt;/p&gt;

&lt;p&gt;Here, you are in charge of flow.&lt;/p&gt;

&lt;p&gt;On the other hand, Framework itself makes a call to your code and provide you with some space to write down details.&lt;/p&gt;

&lt;p&gt;So, while using framework your framework is in charge of flow.&lt;/p&gt;

&lt;p&gt;In Library, your code is going to call the Library whereas, in Framework, your code is being called by Framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is  Build tools in React Js:
&lt;/h2&gt;

&lt;p&gt;Build tools in React.js are software utilities that automate the process of transforming your raw development code into a optimized, production-ready application.&lt;/p&gt;

&lt;p&gt;Because browsers cannot natively understand the JSX, TypeScript, or modern ES6+ JavaScript these tools bridge the gap by "building" the code into standard JavaScript, HTML, and CSS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Popular build tools in React :
&lt;/h2&gt;

&lt;p&gt;🔹Vite&lt;br&gt;
🔹Webpack&lt;br&gt;
🔹Parcel &lt;br&gt;
🔹Rollup&lt;br&gt;
🔹Rsbuild &lt;br&gt;
🔹Turbopack&lt;/p&gt;

&lt;h2&gt;
  
  
  Vite
&lt;/h2&gt;

&lt;p&gt;Currently the most popular choice.&lt;/p&gt;

&lt;p&gt;Vite is a modern frontend build tool designed to provide a significantly faster and leaner development experience for web projects.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>react</category>
      <category>learning</category>
    </item>
    <item>
      <title>Closure</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Wed, 06 May 2026 12:20:20 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/closure-1i43</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/closure-1i43</guid>
      <description>&lt;h2&gt;
  
  
  Definition of Closure :
&lt;/h2&gt;

&lt;p&gt;A closure is a function that remembers and accesses variables from its outer scope even after the outer function has finished executing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example Program :
&lt;/h2&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%2Fipf6vkzezp12fbolq0t6.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%2Fipf6vkzezp12fbolq0t6.png" alt=" " width="692" height="626"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Output :
&lt;/h2&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%2F1xtqlt4z10y3v3vz2eyw.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%2F1xtqlt4z10y3v3vz2eyw.png" alt=" " width="307" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>To Do List Project Using Html,Css and Javascript</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Wed, 06 May 2026 07:47:59 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/to-do-list-project-using-htmlcss-and-javascript-bmj</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/to-do-list-project-using-htmlcss-and-javascript-bmj</guid>
      <description>&lt;h2&gt;
  
  
  HTML CODE :
&lt;/h2&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%2Fcadn2qbx805eo5pc5uss.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%2Fcadn2qbx805eo5pc5uss.png" alt=" " width="800" height="173"&gt;&lt;/a&gt;.  &lt;/p&gt;

&lt;h2&gt;
  
  
  JAVASCRIPT :
&lt;/h2&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%2Fzeep3kpko4p1cr3iv15r.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%2Fzeep3kpko4p1cr3iv15r.png" alt=" " width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CSS :
&lt;/h2&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%2Fn5nr8dglq2deum2rve6r.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%2Fn5nr8dglq2deum2rve6r.png" alt=" " width="592" height="543"&gt;&lt;/a&gt;&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%2Fny4pt98rscvpm1dmkxhe.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%2Fny4pt98rscvpm1dmkxhe.png" alt=" " width="591" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  OUTPUT :
&lt;/h2&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%2Fbl7ejttvy6kzjsfggf3d.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%2Fbl7ejttvy6kzjsfggf3d.png" alt=" " width="710" height="340"&gt;&lt;/a&gt;&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%2Fxs2ls4v4stnzzibpw61w.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%2Fxs2ls4v4stnzzibpw61w.png" alt=" " width="424" height="638"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>DOM Exercises</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Wed, 29 Apr 2026 06:42:46 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/dom-exercises-960</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/dom-exercises-960</guid>
      <description>&lt;h2&gt;
  
  
  Change text :
&lt;/h2&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%2Fvblefv08nl5x3jyr4jx6.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%2Fvblefv08nl5x3jyr4jx6.png" alt=" " width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F4x1m3wjil3722oe0s4n8.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%2F4x1m3wjil3722oe0s4n8.png" alt=" " width="800" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ON/OFF Toggle button :
&lt;/h2&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%2F2a1vachgiudkrulpg8an.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%2F2a1vachgiudkrulpg8an.png" alt=" " width="800" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fhhmeel818cbxeu53rbxr.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%2Fhhmeel818cbxeu53rbxr.png" alt=" " width="162" height="215"&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%2Fefzrm6qcs5bk7tqtbl63.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%2Fefzrm6qcs5bk7tqtbl63.png" alt=" " width="170" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Count increment, decrement and reset :
&lt;/h2&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%2Fqnmuq2d03i7a0p1bqlsw.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%2Fqnmuq2d03i7a0p1bqlsw.png" alt=" " width="800" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F8ux1a0cdsa4j23qwb7pr.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%2F8ux1a0cdsa4j23qwb7pr.png" alt=" " width="800" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>Commonly asked interview questions about DOM in Javascript</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Tue, 28 Apr 2026 05:45:05 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/commonly-asked-interview-questions-about-dom-in-javascript-54om</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/commonly-asked-interview-questions-about-dom-in-javascript-54om</guid>
      <description>&lt;h2&gt;
  
  
  1. What is DOM :
&lt;/h2&gt;

&lt;p&gt;🔹DOM stands for Document Object Model.&lt;/p&gt;

&lt;p&gt;🔹DOM is a programming interface that represents a web pages as a tree like structure, where every element like html tags,attributes and text is an object that can be accessed and modified using javascript.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. How is the DOM different from HTML?
&lt;/h2&gt;

&lt;p&gt;🔹HTML is a static code to define webpages structure.while DOM is the live memory representation of that structure.&lt;/p&gt;

&lt;p&gt;▪️HTML exists the file and shows the initial content.&lt;/p&gt;

&lt;p&gt;▪️DOM generated from HTML and CSS can be modified dynamically by javascript.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What are the different ways to select elements?
&lt;/h2&gt;

&lt;p&gt;Common methods,&lt;br&gt;
🔹&lt;code&gt;getElementById()&lt;/code&gt;,&lt;/p&gt;

&lt;p&gt;🔹&lt;code&gt;getElementsByClassName()&lt;/code&gt;, &lt;br&gt;
🔹&lt;code&gt;getElementsByTagName()&lt;/code&gt;, 🔹&lt;code&gt;querySelector()&lt;/code&gt;, 🔹&lt;code&gt;querySelectorAll()&lt;/code&gt;.&lt;br&gt;
(TO BE DISCUSSED)&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Compare innerHTML, innerText, and textContent.
&lt;/h2&gt;

&lt;p&gt;🔹&lt;code&gt;innerText&lt;/code&gt;: Gets/sets only visible text.&lt;/p&gt;

&lt;p&gt;🔹&lt;code&gt;innerHTML&lt;/code&gt;: Gets/sets HTML markup inside an element.  (TBD)&lt;/p&gt;

&lt;p&gt;🔹&lt;code&gt;textContent&lt;/code&gt;: Gets/sets all text content, including hidden text, and is faster than &lt;code&gt;innerText&lt;/code&gt;. (TBD)&lt;/p&gt;

&lt;h2&gt;
  
  
  5. How do you create and add a new element dynamically?
&lt;/h2&gt;

&lt;p&gt;🔹Use  &lt;code&gt;document.createElement()&lt;/code&gt; to create the element.&lt;/p&gt;

&lt;p&gt;🔹Use&lt;code&gt;appendChild()&lt;/code&gt; or &lt;code&gt;insertBefore()&lt;/code&gt; to add it to the DOM tree.     (TBD)&lt;/p&gt;

&lt;h2&gt;
  
  
  6. What are JavaScript events?
&lt;/h2&gt;

&lt;p&gt;🔹 Events are actions that occur in the browser, such as clicks, key presses, or page loads.&lt;/p&gt;

&lt;p&gt;🔹 JavaScript can listen for these events and execute functions when they occur.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. How do you add an event listener to an element? (TBD)
&lt;/h2&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;myButton&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;click&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="p"&gt;()&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;Button Clicked!&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;h2&gt;
  
  
  8. Explain the different types of DOM nodes.
&lt;/h2&gt;

&lt;p&gt;🔹 Document node (root),&lt;br&gt;
🔹 Element nodes (tags), &lt;br&gt;
🔹 Attribute nodes, &lt;br&gt;
🔹 Text nodes.    (TBD)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Javascript Scenario question using (variables, operators, conditional statements) - 2</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Sat, 18 Apr 2026 15:25:40 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/javascript-scenario-question-using-variables-operators-conditional-statements-2-33ic</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/javascript-scenario-question-using-variables-operators-conditional-statements-2-33ic</guid>
      <description>&lt;h2&gt;
  
  
  1. Check number is even or odd:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2F15zkzbqccjn0mzvcr6z1.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%2F15zkzbqccjn0mzvcr6z1.jpg" alt=" " width="720" height="400"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT:&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%2Fpml9gd1xk08x5m92lano.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%2Fpml9gd1xk08x5m92lano.jpg" alt=" " width="720" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Compare two passwords entered by user.
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2F79uecn92zohl98dcq1h5.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%2F79uecn92zohl98dcq1h5.jpg" alt=" " width="719" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fm1paxwvn8yqpkr66uapu.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%2Fm1paxwvn8yqpkr66uapu.jpg" alt=" " width="720" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Write condition if person age &amp;gt;= 18 is eligible to vote:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fs28j85rai7gt4f7u9zy2.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%2Fs28j85rai7gt4f7u9zy2.jpg" alt=" " width="720" height="464"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT:&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%2Faau4wz4gb0secuo4miaf.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%2Faau4wz4gb0secuo4miaf.jpg" alt=" " width="720" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Use logical AND to check:
&lt;/h2&gt;

&lt;p&gt;▪️User is logged in&lt;/p&gt;

&lt;p&gt;▪️User is admin Then allow dashboard access.&lt;/p&gt;

&lt;p&gt;PROGRAM:&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%2F3lr791xtjuqyqddv95hs.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%2F3lr791xtjuqyqddv95hs.jpg" alt=" " width="720" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fjmvpbbtfoqrn3gw392rq.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%2Fjmvpbbtfoqrn3gw392rq.jpg" alt=" " width="720" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5.calculates total cart amount:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fxncitcjq02twhpey3ur8.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%2Fxncitcjq02twhpey3ur8.jpg" alt=" " width="720" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fpwd1f12ei86ow8vrl6uf.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%2Fpwd1f12ei86ow8vrl6uf.jpg" alt=" " width="720" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. greet a user by name:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2F6knhoj5ollqxv99962hx.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%2F6knhoj5ollqxv99962hx.jpg" alt=" " width="720" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fttu7r6ojcipkvw41mv1w.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%2Fttu7r6ojcipkvw41mv1w.jpg" alt=" " width="720" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. convert Celsius to Fahrenheit:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fo7dm8obmlfggsxdzib8n.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%2Fo7dm8obmlfggsxdzib8n.jpg" alt=" " width="720" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fsy877civgllzrnvqwk50.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%2Fsy877civgllzrnvqwk50.jpg" alt=" " width="720" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8. returns the largest of two numbers:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fuqiwh2fwwvpqw4acwc36.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%2Fuqiwh2fwwvpqw4acwc36.jpg" alt=" " width="720" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F9h0butllycqa0nixedan.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%2F9h0butllycqa0nixedan.jpg" alt=" " width="720" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Check user role:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fr6o8uq35kdd6i1dww8ma.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%2Fr6o8uq35kdd6i1dww8ma.jpg" alt=" " width="720" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fkmdwec6wyey6kuh1xkmo.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%2Fkmdwec6wyey6kuh1xkmo.jpg" alt=" " width="720" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Check number is positive, negative, or zero:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fy285224sfuo84dnufbcg.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%2Fy285224sfuo84dnufbcg.jpg" alt=" " width="720" height="542"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fxmkfnly942hz0xj6uysm.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%2Fxmkfnly942hz0xj6uysm.jpg" alt=" " width="720" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  11. Check a year is leap year:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fqun7xu632xtyuowft7ef.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%2Fqun7xu632xtyuowft7ef.jpg" alt=" " width="720" height="415"&gt;&lt;/a&gt;&lt;br&gt;
OUTPUT:&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%2Fd4fwu8dk2gdp9mbo84e3.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%2Fd4fwu8dk2gdp9mbo84e3.jpg" alt=" " width="720" height="199"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  12. Movie ticket pricing:child age below 12-&amp;gt;100, adult age above 12-&amp;gt;200:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fd7pavxzwz0z7ok7z84g8.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%2Fd7pavxzwz0z7ok7z84g8.jpg" alt=" " width="720" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fc7nt8cx8kn5okvu1cuav.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%2Fc7nt8cx8kn5okvu1cuav.jpg" alt=" " width="720" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  13. If marks &amp;gt;= 90 Grade A,75→ Grade B else → Fail:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fvujou9iwnxnidtluyckd.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%2Fvujou9iwnxnidtluyckd.jpg" alt=" " width="720" height="526"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fumjwm577ao19e1qfezap.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%2Fumjwm577ao19e1qfezap.jpg" alt=" " width="720" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>coding</category>
    </item>
    <item>
      <title>JavaScript scenario questions using(Variables, operators, conditional Statements)</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Sat, 18 Apr 2026 05:29:19 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/javascript-scenario-questions-usingvariables-operators-conditional-statements-31fj</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/javascript-scenario-questions-usingvariables-operators-conditional-statements-31fj</guid>
      <description>&lt;h2&gt;
  
  
  1. building a login system:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2F778oeeufnvrdrm1upfgi.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%2F778oeeufnvrdrm1upfgi.jpg" alt=" " width="720" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Ftcg78jryp8doy5a2bewy.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%2Ftcg78jryp8doy5a2bewy.jpg" alt=" " width="720" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Print a given message:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fw1mq7eufbk0cqodbt8j0.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%2Fw1mq7eufbk0cqodbt8j0.jpg" alt=" " width="720" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F4udj3vh95jjezuhp815y.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%2F4udj3vh95jjezuhp815y.jpg" alt=" " width="720" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. calculate the student marks:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fughkoprdbq0yuj9faii7.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%2Fughkoprdbq0yuj9faii7.jpg" alt=" " width="720" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F9v1gs1qzku93hq6wvkfy.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%2F9v1gs1qzku93hq6wvkfy.jpg" alt=" " width="720" height="199"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Swap two numbers without using a third variable.
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Fsu5ewxfjp3fznesnobon.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%2Fsu5ewxfjp3fznesnobon.jpg" alt=" " width="720" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Frwx8nklcny77264wdc4u.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%2Frwx8nklcny77264wdc4u.jpg" alt=" " width="720" height="245"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. User is logged in or not and show a message:
&lt;/h2&gt;

&lt;p&gt;PROGRAM:&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%2Ftlbmqkmthb1aog9y42js.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%2Ftlbmqkmthb1aog9y42js.jpg" alt=" " width="720" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fh8plzfhakpydcdqo0y11.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%2Fh8plzfhakpydcdqo0y11.jpg" alt=" " width="720" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
      <category>programming</category>
    </item>
    <item>
      <title>Objects &amp; Array Scenario Questions</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Fri, 17 Apr 2026 09:35:02 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/objects-array-scenario-questions-2722</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/objects-array-scenario-questions-2722</guid>
      <description>&lt;h2&gt;
  
  
  1. User Profile Update
&lt;/h2&gt;

&lt;p&gt;const user = {&lt;/p&gt;

&lt;p&gt;name: "Vijay",&lt;/p&gt;

&lt;p&gt;age: 25,&lt;/p&gt;

&lt;p&gt;email: "&lt;a href="mailto:ideva4739@gmail.com"&gt;ideva4739@gmail.com&lt;/a&gt;"&lt;/p&gt;

&lt;p&gt;};&lt;/p&gt;

&lt;p&gt;▪️Update email and a new property is active = true.&lt;/p&gt;

&lt;p&gt;PROGRAM:&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%2Fj5mtyi1wpaxkng5xga45.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%2Fj5mtyi1wpaxkng5xga45.jpg" alt=" " width="720" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;EXPLANATION:&lt;/p&gt;

&lt;p&gt;🔹In this question first condition update a new email instead of existing email.&lt;/p&gt;

&lt;p&gt;🔹If you want update a values give object name and update value in between (.)dot operator.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;▪️dot operator is used to            seperate the object name and key name.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;🔹So, give user.email= &lt;a href="mailto:ideva537@gmail.com"&gt;ideva537@gmail.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;🔹Then add a new element is active= true.&lt;/p&gt;

&lt;p&gt;🔹So, create new variable user.isActive= true.&lt;/p&gt;

&lt;p&gt;🔹Then print the user.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fb3f1j8cprjfn7sayydhp.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%2Fb3f1j8cprjfn7sayydhp.jpg" alt=" " width="720" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Shopping Cart Total
&lt;/h2&gt;

&lt;p&gt;const cart = [&lt;/p&gt;

&lt;p&gt;(name: "Shirt", price: 500).&lt;/p&gt;

&lt;p&gt;(name: "Shoes", price: 1500).&lt;/p&gt;

&lt;p&gt;(name: "Cap", price: 300)&lt;/p&gt;

&lt;p&gt;▪️Calculate total price.&lt;/p&gt;

&lt;p&gt;PROGRAM:&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%2Fqzt87i7vftudx2hozmvd.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%2Fqzt87i7vftudx2hozmvd.jpg" alt=" " width="720" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fxvu8b7kcx0py5iiim92d.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%2Fxvu8b7kcx0py5iiim92d.jpg" alt=" " width="720" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Find Specific Object
&lt;/h2&gt;

&lt;p&gt;const users =[&lt;br&gt;
{name: "Vijay", age: 25}, &lt;br&gt;
{name: "Arun", age: 30}, &lt;br&gt;
{name: "Kumar", age: 28}&lt;br&gt;
];&lt;/p&gt;

&lt;p&gt;▪️From an array of users, find the user whose name is "Arun"&lt;/p&gt;

&lt;p&gt;PROGRAM:&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%2Fh6tdlmnd76cz6o0qt4nw.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%2Fh6tdlmnd76cz6o0qt4nw.jpg" alt=" " width="720" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fydq4wy7h84lprjgjf9zc.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%2Fydq4wy7h84lprjgjf9zc.jpg" alt=" " width="720" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Add Item to Array
&lt;/h2&gt;

&lt;p&gt;const products= [&lt;br&gt;
{name: "Shirt", price: 500},&lt;br&gt;
{name: "Shoes", price: 1500}&lt;br&gt;
];&lt;br&gt;
▪️Add a new property to an existing array.&lt;/p&gt;

&lt;p&gt;▪️Remove the product name "Shoes" from the array.&lt;/p&gt;

&lt;p&gt;▪️From product list return price &amp;gt; 1000 items only.&lt;/p&gt;

&lt;p&gt;PROGRAM:&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%2F1st3frp7taebysgalpwa.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%2F1st3frp7taebysgalpwa.jpg" alt=" " width="720" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F2y8d3ra9xdzmgmqcevl5.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%2F2y8d3ra9xdzmgmqcevl5.jpg" alt=" " width="720" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Count Items in Object
&lt;/h2&gt;

&lt;p&gt;const fruits = {&lt;br&gt;
   apple: 2,&lt;br&gt;
   banana: 5, &lt;br&gt;
   mango: 3 &lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;▪️Find the total number of fruits.&lt;/p&gt;

&lt;p&gt;PROGRAM:&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%2Fj2dpcvmtt73wiegtda3z.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%2Fj2dpcvmtt73wiegtda3z.jpg" alt=" " width="720" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F6vyukff8c75w5m9fb6p6.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%2F6vyukff8c75w5m9fb6p6.jpg" alt=" " width="720" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Convert Array to Object
&lt;/h2&gt;

&lt;p&gt;const users = ["Vijay", "Arun", "Kumar"];&lt;/p&gt;

&lt;p&gt;▪️Convert into:&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Vijay: true,

Arun: true,

Kumar: true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;PROGRAM:&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%2F5xdge8of6skyxbkz5ues.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%2F5xdge8of6skyxbkz5ues.jpg" alt=" " width="720" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F95lfy6xy3tcky8z1pcwe.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%2F95lfy6xy3tcky8z1pcwe.jpg" alt=" " width="720" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>learning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Detail About These Interview Questions: 1.What is Javascript 2.Data types in Js and Difference Between Primitive and Non Primitive 3.Variable in js</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Thu, 09 Apr 2026 16:05:44 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/detail-about-these-interview-questions-1what-is-javascript-2data-types-in-js-and-difference-3kef</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/detail-about-these-interview-questions-1what-is-javascript-2data-types-in-js-and-difference-3kef</guid>
      <description>&lt;h2&gt;
  
  
  1.What is Javascript:
&lt;/h2&gt;

&lt;p&gt;◾Java script is a high level programing language that used alongside HTML and CSS.&lt;/p&gt;

&lt;p&gt;◾It's a object oriented programming language.&lt;/p&gt;

&lt;p&gt;◾It is used to define the behaviour of the HTML and CSS,&lt;/p&gt;

&lt;p&gt;◾Java script is a most widely used frontend language in the world wide.&lt;/p&gt;

&lt;p&gt;◾It is used for interact web application and supports both client side and server side development. &lt;/p&gt;

&lt;p&gt;◾Client side means code runs on the user's computer and server side means it's runs on the web browser.&lt;/p&gt;

&lt;p&gt;◾JavaScript is a single-threaded language that executes one task at a time.&lt;/p&gt;

&lt;p&gt;◾Java script was created by BRENDON EICH in 1995.He's a computer programmer and technology executive.&lt;/p&gt;

&lt;p&gt;◾Brendon takes only 10 days to create java script.&lt;/p&gt;

&lt;p&gt;◾Java script mainly used browsers,not only browser also on servers, mobile apps and AI tools.&lt;/p&gt;

&lt;p&gt;1.Why this language has the name of Java script?&lt;/p&gt;

&lt;p&gt;✓ In the initial stage it was named by "MOCHA" and later renamed "LIVE SCRIPT"&lt;/p&gt;

&lt;p&gt;✓ Then they conclude the popularity of JAVA language at the time,so its inspired JAVA language to renamed "JAVA SCRIPT".&lt;/p&gt;

&lt;p&gt;2.Why java script is a scripting language?&lt;/p&gt;

&lt;p&gt;✓ Java script does not need any compiler to run this code,they run on runtime browsers&lt;/p&gt;

&lt;p&gt;✓ It is interpreted line by line execution.&lt;/p&gt;

&lt;p&gt;✓ Example Java code need a compiler to read the code to machine language(binary) and then to compiled servers,but javascript does not need compilers to convert machine language they directly runs on browsers.&lt;/p&gt;

&lt;p&gt;✓ Python is one of the most popular  scripting languages. Known for its simple syntax and readability&lt;/p&gt;

&lt;h2&gt;
  
  
  2.What are the data types are in javascript?
&lt;/h2&gt;

&lt;p&gt;∆ Data types are two types,they are&lt;br&gt;
1.primitive data type&lt;br&gt;
2.non primitive data type&lt;/p&gt;

&lt;p&gt;∆ Javascript using 8 primitive data types,they are Number,Boolean, Bigint,String, Undefined,Null,Nan and Symbol.&lt;/p&gt;

&lt;p&gt;Number:&lt;br&gt;
✓ Its using to denote numbers like&lt;br&gt;
Ex:19,12,4,2&lt;/p&gt;

&lt;p&gt;Boolean:&lt;br&gt;
✓ boolean denoted by true or false.&lt;/p&gt;

&lt;p&gt;Bigint:&lt;br&gt;
✓ Normally integer values are number,on the other hand bigint means big numbers.&lt;br&gt;
Ex:2527788373782,2773993736.&lt;/p&gt;

&lt;p&gt;String:&lt;br&gt;
✓ Strings are set of characters enclosed single''or double""quotes.&lt;br&gt;
Ex:"Deva",'blog'.&lt;/p&gt;

&lt;p&gt;Undefined:&lt;br&gt;
✓ Undefined is variable can be exist but not value assigned&lt;/p&gt;

&lt;p&gt;Null:&lt;br&gt;
✓ Null is denoted by empty value or 0 value.&lt;/p&gt;

&lt;p&gt;Symbol:&lt;br&gt;
✓ This used to unique symbol like percentage,greater than and lessthan etc.&lt;/p&gt;

&lt;p&gt;∆ Non primitive data types are object, array and function.&lt;/p&gt;

&lt;p&gt;Object:&lt;br&gt;
✓ Object is a collection of key value pairs used to store data and entities.&lt;/p&gt;

&lt;p&gt;✓ Denoted using curley braces{}&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = { name: "Deva", age: 22 };
console.log(user.name);// Output: Deva
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Array:&lt;br&gt;
✓ Array is one of the object and used for storing multiple elements in a single container.&lt;/p&gt;

&lt;p&gt;✓ Arrays are denoted in square brackets[].&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const colors = ["red", "green", "blue"];
console.log(colors[0]); // Returns red
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Function:&lt;br&gt;
✓ A function is a reusable block of code designed to perform a specific task&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function welcome(name) {
  return "Hello, " + name;
}
console.log(welcome("Deva"));// Output: Hello Deva
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Difference Between Primitive and Non Primitive Data Types:
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Primitive Data types:
&lt;/h2&gt;

&lt;p&gt;◾&lt;code&gt;Immutable&lt;/code&gt;: Values cannot be changed.&lt;/p&gt;

&lt;p&gt;◾ Immutable means if the value reassign does not replace a memory of older one's.Rather than creates a new memory to store the value.&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 plaintext"&gt;&lt;code&gt;let i = 10;
    i = 12;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔹In the above example the variable are declared and initialize the value 10.&lt;/p&gt;

&lt;p&gt;🔹Then reassign the value 12.&lt;/p&gt;

&lt;p&gt;🔹In this situation first memory creates and assign the value 10.&lt;/p&gt;

&lt;p&gt;🔹Next the reassign value 12 is not assigned the memory of value 10.&lt;/p&gt;

&lt;p&gt;🔹It creates a new memory and stores that value.&lt;/p&gt;

&lt;p&gt;◾Storage:Stores by values in the stack.&lt;/p&gt;

&lt;p&gt;🔹Every value stored by stack order&lt;br&gt;
line by line.&lt;/p&gt;

&lt;p&gt;🔹First value stored and then second value stored above the first value.&lt;/p&gt;

&lt;p&gt;◾ Comparison:Compared by actual value.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fc1d1j6ujxk086dchrjs0.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%2Fc1d1j6ujxk086dchrjs0.jpg" alt=" " width="720" height="257"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fgflacjkun2dmvdh8rzmb.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%2Fgflacjkun2dmvdh8rzmb.jpg" alt=" " width="720" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹It's compared by values (i(10)==j (10))&lt;br&gt;
Prints true.&lt;/p&gt;

&lt;p&gt;◾Methods:Do not have any methods but use the wrappers.&lt;/p&gt;

&lt;p&gt;◾Starts with a lowercase.&lt;/p&gt;
&lt;h2&gt;
  
  
  Non Primitive Data types:
&lt;/h2&gt;

&lt;p&gt;◾Mutable:Values can be changed or modified.&lt;/p&gt;

&lt;p&gt;◾Storing:Storing by the heap.&lt;/p&gt;

&lt;p&gt;🔹Does not follow the any order store a heap order.&lt;/p&gt;

&lt;p&gt;◾Comparison:Compared by memory reference or address.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fnzoc1e3tcjxtsci7l3c8.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%2Fnzoc1e3tcjxtsci7l3c8.jpg" alt=" " width="720" height="244"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹In this program the array values i = [10] and j = [10] is have the same value 10.&lt;/p&gt;

&lt;p&gt;🔹But [10] = [10] are not take the value, it takes the memory address of the value.&lt;/p&gt;

&lt;p&gt;🔹So it's returns the false.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Ff0vvlhhqpz2m8hjept2p.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%2Ff0vvlhhqpz2m8hjept2p.jpg" alt=" " width="720" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;◾Can have the methods and properties.&lt;/p&gt;

&lt;p&gt;◾ It's only starts with a uppercase.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Variables:
&lt;/h2&gt;

&lt;p&gt;◾Variables is a data containers&lt;/p&gt;

&lt;p&gt;◾Variables are used to store data values.&lt;/p&gt;

&lt;p&gt;◾The variables can be stored 4 different ways how the values should behave.&lt;/p&gt;

&lt;p&gt;◾Older Javascript:&lt;br&gt;
  🔹Using &lt;code&gt;var&lt;/code&gt;&lt;br&gt;
  🔹Automatically&lt;br&gt;
(Both are not recommended)&lt;/p&gt;

&lt;p&gt;◾Modern Javascript:&lt;br&gt;
  🔹Using &lt;code&gt;let&lt;/code&gt;&lt;br&gt;
  🔹Using &lt;code&gt;const&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Using the let:&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%2Fq5sj0e8tl9s7mijnhxas.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%2Fq5sj0e8tl9s7mijnhxas.jpg" alt=" " width="720" height="284"&gt;&lt;/a&gt;&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%2F40u79p93bbw8b36t0k6l.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%2F40u79p93bbw8b36t0k6l.jpg" alt=" " width="720" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹i contains the value 5&lt;br&gt;
🔹j contains the value 6&lt;br&gt;
🔹k adds the i and j stores the value 11.&lt;/p&gt;

&lt;p&gt;Using the const:&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%2Fhyrkeknd1oc3z0sztvkg.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%2Fhyrkeknd1oc3z0sztvkg.jpg" alt=" " width="720" height="253"&gt;&lt;/a&gt;&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%2Fzu6xeqhhwtn7bratd607.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%2Fzu6xeqhhwtn7bratd607.jpg" alt=" " width="720" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹i contains the value 7&lt;br&gt;
🔹j contains the value 3&lt;br&gt;
🔹k adds the i and j stores the value 10.&lt;/p&gt;

&lt;p&gt;JAVASCRIPT IDENTIFIERS:&lt;/p&gt;

&lt;p&gt;◾ Variables are identified with unique names called identifiers.&lt;/p&gt;

&lt;p&gt;◾The rules for creating a name are:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🔹Names can contain letters, digits, underscores, and dollar signs.

🔹Names must begin with a letter, a $ sign or an underscore (_).

🔹Names are case sensitive ,because capital X is different from small x.

🔹Reserved  JavaScript  keywords like `const`, `let` `import`,`export` cannot be used as names.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Javascript Underscore(_):&lt;/p&gt;

&lt;p&gt;◾The underscore is treated as a letter in JavaScript names.&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%2Fsjv1urlgot0joprdx86b.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%2Fsjv1urlgot0joprdx86b.jpg" alt=" " width="720" height="278"&gt;&lt;/a&gt;&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%2F94oo2fus68yl28235ryk.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%2F94oo2fus68yl28235ryk.jpg" alt=" " width="720" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Javascript Dollor sign $:&lt;/p&gt;

&lt;p&gt;◾The Dollor sign also treated as a letter in JavaScript names.&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%2Fm29fkvi0m26jjl1m15he.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%2Fm29fkvi0m26jjl1m15he.jpg" alt=" " width="720" height="266"&gt;&lt;/a&gt;&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%2Fgwca3w6l30h99p4wk5ls.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%2Fgwca3w6l30h99p4wk5ls.jpg" alt=" " width="720" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DECLARING A JAVASCRIPT VARIABLES:&lt;/p&gt;

&lt;p&gt;◾Creating a variable in JavaScript is called declaring a variable.&lt;/p&gt;

&lt;p&gt;◾Using &lt;code&gt;let&lt;/code&gt; and  &lt;code&gt;const&lt;/code&gt; keywords to declare a variable in javascript.&lt;/p&gt;

&lt;p&gt;Declaring a Variable Using let:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let Phonename = "Realme";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔹After the declaration, you'll not assign the value it is &lt;code&gt;undefined&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;🔹assign a value to a variable using equal = (assignment operator)&lt;/p&gt;

&lt;p&gt;🔹It's better to assign the value while you declared a variable.&lt;/p&gt;

&lt;p&gt;Declaring a Variable Using const:&lt;/p&gt;

&lt;p&gt;◾Always use &lt;code&gt;const&lt;/code&gt; if the value should not be changed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Phonename = "Realme";``
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When to Use var, let, or const?&lt;/p&gt;

&lt;p&gt;◾Always declare a variables&lt;/p&gt;

&lt;p&gt;◾Always use &lt;code&gt;const&lt;/code&gt;, if the value should not be changed.&lt;/p&gt;

&lt;p&gt;◾Only use&lt;code&gt;let&lt;/code&gt;if you cannot use const.&lt;/p&gt;

&lt;p&gt;◾Never used &lt;code&gt;var&lt;/code&gt;and declare variable automatically.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
      <category>writing</category>
    </item>
    <item>
      <title>Details About the Basic Array Methods</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Wed, 08 Apr 2026 15:01:20 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/details-about-the-basic-array-methods-3b6i</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/details-about-the-basic-array-methods-3b6i</guid>
      <description>&lt;p&gt;In the previous blog I was post the basic array methods.In this blog discuss the detail about the array methods.&lt;/p&gt;

&lt;h2&gt;
  
  
  Array length:
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;length&lt;/code&gt; method returns the count or size of an array.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fus3mpci1bbbtocchydb2.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%2Fus3mpci1bbbtocchydb2.jpg" alt=" " width="720" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹In the array have 5 elements,so its returns the length 5.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F9e9j81zp0vmir4iasof6.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%2F9e9j81zp0vmir4iasof6.jpg" alt=" " width="720" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array toString()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;tostring()&lt;/code&gt;method returns the elements of an array to a separated string with a comma.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2F2zd8nz8nycmq8wde9jyy.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%2F2zd8nz8nycmq8wde9jyy.jpg" alt=" " width="720" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹This method converts a every single Mobilebrand into an one single array seperate a comma.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fqu46wkj8jct1hmjwmfgt.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%2Fqu46wkj8jct1hmjwmfgt.jpg" alt=" " width="720" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array at()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;at()&lt;/code&gt; method returns an indexed element from an array.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fs1zy5ef6gncxeb12xfmr.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%2Fs1zy5ef6gncxeb12xfmr.jpg" alt=" " width="720" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹 Mobilebrand.at(3) returns a indexed element 3 'samsung'.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F7pjqtiko1tp8hd4c753g.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%2F7pjqtiko1tp8hd4c753g.jpg" alt=" " width="720" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Array Join()&lt;br&gt;
◾The &lt;code&gt;join()&lt;/code&gt; method also joins all array elements into a string.&lt;/p&gt;

&lt;p&gt;◾This acts like a tostring().&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2F4k7581ok1fd5qmr5cqq3.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%2F4k7581ok1fd5qmr5cqq3.jpg" alt=" " width="720" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹In this join() method we give a (+),so its create a array into a string joins with inbetween (+) element.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F7aj9k3248g9yuvek3p2p.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%2F7aj9k3248g9yuvek3p2p.jpg" alt=" " width="720" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array pop()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;pop()&lt;/code&gt; method removes the last element from an array.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2F97sharo8ldjamscxityk.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%2F97sharo8ldjamscxityk.jpg" alt=" " width="720" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹pop() method removes the end element 'nothing' frome the array.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F4u560n5eqgq13r3unq7r.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%2F4u560n5eqgq13r3unq7r.jpg" alt=" " width="720" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array push()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;push()&lt;/code&gt; method adds a new element in the end of an array.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fraipeff24k0vd8zzvio3.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%2Fraipeff24k0vd8zzvio3.jpg" alt=" " width="720" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹push() method adds a 'vivo' end of the array.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fbmozx9gnrn53r8cjdy5x.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%2Fbmozx9gnrn53r8cjdy5x.jpg" alt=" " width="720" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array shift()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;shift()&lt;/code&gt; method removes the first array element and "shifts" all other elements to a starting index.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2F7qtqaq871tjcqk1z5tq4.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%2F7qtqaq871tjcqk1z5tq4.jpg" alt=" " width="720" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹Shift() method removes first element 'realme'.&lt;/p&gt;

&lt;p&gt;🔹The balance elements shifts the place of removed element.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fiw2arktr2qaa9qxw3t9d.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%2Fiw2arktr2qaa9qxw3t9d.jpg" alt=" " width="720" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array unshift()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;unshift()&lt;/code&gt; method adds a new element in the beginning of an array and the other elements unshifts the older elements.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2F1o6p8j7q78vwpwfch8us.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%2F1o6p8j7q78vwpwfch8us.jpg" alt=" " width="720" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹'oneplus' added to the beginning of the array.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fzrrox4hbxk4e1yhiq2a0.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%2Fzrrox4hbxk4e1yhiq2a0.jpg" alt=" " width="720" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array.isArray()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;Array.isArray()&lt;/code&gt;used to finds array is really a array to returns a true.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fgqjx5dh88kvy77djxh8e.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%2Fgqjx5dh88kvy77djxh8e.jpg" alt=" " width="720" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹Mobilebrand is array,so its returns a true.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F3nf3rpmsom91cnhbbovz.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%2F3nf3rpmsom91cnhbbovz.jpg" alt=" " width="720" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array delete()
&lt;/h2&gt;

&lt;p&gt;◾&lt;code&gt;delete()&lt;/code&gt;method returns a undefined.&lt;/p&gt;

&lt;p&gt;◾Use the push and pop method instead of delete.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fibn4zojl0vbqxhwtwrql.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%2Fibn4zojl0vbqxhwtwrql.jpg" alt=" " width="720" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹Mobilebrand[1] defines undefined.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fr6qzxk6lwy2sjf5lh0xl.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%2Fr6qzxk6lwy2sjf5lh0xl.jpg" alt=" " width="720" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array concat()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;concat()&lt;/code&gt; method creates a new array to merging the existing arrays.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fupxhchimyrkldfb2re3t.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%2Fupxhchimyrkldfb2re3t.jpg" alt=" " width="720" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹Concat merge the GroupB array to existing array GroupA to in a single array.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fbmmbjfjrdjkrcnrrj5aw.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%2Fbmmbjfjrdjkrcnrrj5aw.jpg" alt=" " width="720" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array copy Within()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;copy Within()&lt;/code&gt; method copies array elements to another position in an array.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fthm5u62ltxqu2mvko6y1.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%2Fthm5u62ltxqu2mvko6y1.jpg" alt=" " width="720" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fdy304i7rd95i9zgtqhis.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%2Fdy304i7rd95i9zgtqhis.jpg" alt=" " width="720" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array flat()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;flat()&lt;/code&gt; method creates a new array and merge with sub-array.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fk57x87g9g1huocopvs45.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%2Fk57x87g9g1huocopvs45.jpg" alt=" " width="720" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹flat method Merge the sub arrays with array&lt;br&gt;
groups.&lt;/p&gt;

&lt;p&gt;🔹Merge the sub array numbers in one array.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fl0ogkz3fauegsrea341u.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%2Fl0ogkz3fauegsrea341u.jpg" alt=" " width="720" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array splice()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;splice()&lt;/code&gt; method can be used to add new items to an array.&lt;/p&gt;

&lt;p&gt;EXAMPLE 1:&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%2Fzb1ss8d0kpe4i9zniz3n.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%2Fzb1ss8d0kpe4i9zniz3n.jpg" alt=" " width="720" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OUTPUT 1:&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%2Fn0x6ar8ra7ug9hjq784k.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%2Fn0x6ar8ra7ug9hjq784k.jpg" alt=" " width="720" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹The first parameter (2) defines the position where new elements should be added.&lt;/p&gt;

&lt;p&gt;🔹dc and srh added index 2&lt;/p&gt;

&lt;p&gt;🔹The second parameter (0) defines how many elements should be removed.&lt;/p&gt;

&lt;p&gt;🔹Second value is 0 no value has been removed.&lt;/p&gt;

&lt;p&gt;EXAMPLE 2:&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%2Fucdzrxvws188qcnnw4rd.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%2Fucdzrxvws188qcnnw4rd.jpg" alt=" " width="720" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹The first parameter (2) defines the position where new elements should be added.&lt;/p&gt;

&lt;p&gt;🔹dc and srh added index 2&lt;/p&gt;

&lt;p&gt;🔹The second parameter (1) defines how many elements should be removed.&lt;/p&gt;

&lt;p&gt;🔹Second value is 1,so 'rcb' has been removed.&lt;/p&gt;

&lt;p&gt;OUTPUT 2:&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%2Fksp25aed20qtng3xtk5t.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%2Fksp25aed20qtng3xtk5t.jpg" alt=" " width="720" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array Slice()
&lt;/h2&gt;

&lt;p&gt;◾The &lt;code&gt;slice()&lt;/code&gt; method slices out a piece of an array into a new array:&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fa68pjsx632wrp90hgpyk.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%2Fa68pjsx632wrp90hgpyk.jpg" alt=" " width="720" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹Slice out a part of an array starting from array element 1 ("csk")&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F3rflsirbljm3qhdsm112.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%2F3rflsirbljm3qhdsm112.jpg" alt=" " width="720" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array to Spliced()
&lt;/h2&gt;

&lt;p&gt;◾It also removes the element from the array.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2F9458dhvxcmewym0boizp.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%2F9458dhvxcmewym0boizp.jpg" alt=" " width="720" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹'0' defines the index and '2' defines the two elements.&lt;/p&gt;

&lt;p&gt;🔹Elements removed starting from the index 0 to two elements.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fy6q5fjp5dvzmq4itdw91.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%2Fy6q5fjp5dvzmq4itdw91.jpg" alt=" " width="720" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>learning</category>
      <category>writing</category>
    </item>
    <item>
      <title>Discuss about the topics of 1.Constructor Function 2.Return Statement in Javascript 3.Bacis Array Methods</title>
      <dc:creator>Deva I</dc:creator>
      <pubDate>Tue, 07 Apr 2026 14:29:15 +0000</pubDate>
      <link>https://forem.com/deva_i_932c8869ada96d4c9f/discuss-about-the-topics-of-1constructor-function-2return-l13</link>
      <guid>https://forem.com/deva_i_932c8869ada96d4c9f/discuss-about-the-topics-of-1constructor-function-2return-l13</guid>
      <description>&lt;h2&gt;
  
  
  Constructor Function:
&lt;/h2&gt;

&lt;p&gt;◾Constructor function is used to create and initialize multiple objects of the same type.&lt;/p&gt;

&lt;p&gt;◾It overcomes the difficulty of multiline code, construct a single line.&lt;/p&gt;

&lt;p&gt;◾Constructor must be called with the &lt;code&gt;new&lt;/code&gt;operator.&lt;/p&gt;

&lt;p&gt;Const phone1 ={&lt;br&gt;
     brand:"Nothing",&lt;br&gt;
     model:"cmf phone 2pro",&lt;br&gt;
     price:20000&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Const phone2 = {&lt;br&gt;
     brand:"Realme",&lt;br&gt;
     model:"P4 pro",&lt;br&gt;
     price:22000&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;✓ It's a normal object creation for phone details.&lt;/p&gt;

&lt;p&gt;✓ This method enough with two or three phone details.&lt;/p&gt;

&lt;p&gt;✓ What if, can write the details of all realme brand mobiles,so overcome this difficult use a contructor function to construct a code in single line.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example:
&lt;/h2&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%2Fjwzjv1nxenwqnnabjj39.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%2Fjwzjv1nxenwqnnabjj39.jpg" alt=" " width="701" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;EXPLANATION:&lt;/p&gt;

&lt;p&gt;🔹Create a function to give the parameters(Nothing","cmf phone 2pro",20000) of you write.&lt;/p&gt;

&lt;p&gt;🔹Then to sets a this operation to call a properties and methods.&lt;/p&gt;

&lt;p&gt;🔹This multiline code&lt;br&gt;
       brand:"Nothing",&lt;br&gt;
       model:"cmf phone 2pro",&lt;br&gt;
       price:20000 &lt;br&gt;
   Written a single line code of&lt;br&gt;
       const phone 1 = new phone("nothing", "cmf phone 2pro", 20000);&lt;/p&gt;

&lt;p&gt;🔹Writing, const phone2 = new phone("realme", "p4 pro" 22000);&lt;br&gt;
instead of this code&lt;br&gt;
       brand:"Realme",&lt;br&gt;
       model:"P4 pro",&lt;br&gt;
       price:22000&lt;/p&gt;

&lt;p&gt;🔹Use the &lt;code&gt;new&lt;/code&gt;keyword,when you use the new keyword javascript performs the above steps.&lt;/p&gt;

&lt;p&gt;🔹Use the this to Print the code like (this.brand, this.model, this .price);&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2Fc0lvxalcwtfd8kgf6y8q.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%2Fc0lvxalcwtfd8kgf6y8q.jpg" alt=" " width="700" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Return Statement in Javascript:
&lt;/h2&gt;

&lt;p&gt;◾The return statement is used to end function execution and a value to be sent back to the caller.&lt;/p&gt;

&lt;p&gt;◾The caller used that value at any time.&lt;/p&gt;

&lt;p&gt;◾If the caller don't return the value the value won't used to be any variable.&lt;/p&gt;

&lt;p&gt;EXAMPLE:&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%2Fbgwzh57it61cedn0wokn.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%2Fbgwzh57it61cedn0wokn.jpg" alt=" " width="720" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔹Create a function named add(a,b)&lt;/p&gt;

&lt;p&gt;🔹Return the  parameters a and b.&lt;/p&gt;

&lt;p&gt;🔹Create a new variable to store the function name and give the values of parameters.&lt;/p&gt;

&lt;p&gt;🔹Then print the code.&lt;/p&gt;

&lt;p&gt;🔹The sum output 15 is return to the caller function add.&lt;/p&gt;

&lt;p&gt;🔹The value can be used at any variable,if not the give the return statement the value won't be used at any variable.&lt;/p&gt;

&lt;p&gt;OUTPUT:&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%2F9ny2o7xjp2jne5wl0inm.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%2F9ny2o7xjp2jne5wl0inm.jpg" alt=" " width="720" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Returning value of some data types:
&lt;/h2&gt;

&lt;p&gt;Undefined:&lt;br&gt;
Returned for variables declared but not yet assigned a value.&lt;/p&gt;

&lt;p&gt;Boolean:&lt;br&gt;
Returned for true and false.&lt;/p&gt;

&lt;p&gt;Number:&lt;br&gt;
Returned integers(1,2,3), floats(3.1,2.13), and special values like NaN and Infinity.&lt;/p&gt;

&lt;p&gt;BigInt:&lt;br&gt;
Used for larger integers like 123456.&lt;/p&gt;

&lt;p&gt;String:Returned for all textual data with a double quotation like ("javascript","Deva","123")&lt;/p&gt;

&lt;p&gt;Object:Returned for objects {} and arrays [].&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Array Methods:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Array length

Array isArray)

Array toString()

Array delete()

Array at()

Array concat()

Array Join()

Array copy Within()

Array pop()

Array flat()

Array push()

Array slice()

Array shift()

Array splice()

Array unshift()

Array to Spliced()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(To be discussed )&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
