<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Destructuring in JavaScript in Simplest Language]]></title><description><![CDATA[Destructuring in JavaScript in Simplest Language]]></description><link>https://destructuring-in-js.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/678b980cb5c65c2c71ab4ab1/a3d75c01-f172-426b-9c8e-1c899066daf7.webp</url><title>Destructuring in JavaScript in Simplest Language</title><link>https://destructuring-in-js.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Sep 2026 21:36:07 GMT</lastBuildDate><atom:link href="https://destructuring-in-js.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Destructuring in JS - Explain In Simplest Language]]></title><description><![CDATA[Destructuring assignment -
it allow to unpack values from - [array] & property from {object},
it simply a shortcut way of accessing or printing values from array and property from object,
1) Array[] D]]></description><link>https://destructuring-in-js.hashnode.dev/destructuring-in-js-explain-in-simplest-language</link><guid isPermaLink="true">https://destructuring-in-js.hashnode.dev/destructuring-in-js-explain-in-simplest-language</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[premtakawane]]></category><dc:creator><![CDATA[Prem Takawane]]></dc:creator><pubDate>Mon, 23 Mar 2026 17:24:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/678b980cb5c65c2c71ab4ab1/9905cd26-b6c5-49e2-946a-9d8bd86675a7.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2><strong>Destructuring assignment -</strong></h2>
<p>it allow to unpack <strong>values from - [array]</strong> &amp; <strong>property from {object},</strong></p>
<p>it simply a shortcut way of accessing or printing values from array and property from object,</p>
<h1><strong>1) Array[] Destructuring :</strong></h1>
<pre><code class="language-javascript">// Normol Way To Access Values from Array and Print it,

const MonthOFYear = ["Jan", "Feb", "Mar", "Apr", "May"];

console.log(MonthOFYear[0]);
console.log(MonthOFYear[1]);
console.log(MonthOFYear[2]);
console.log(MonthOFYear[3]);
console.log(MonthOFYear[4]);
</code></pre>
<p>here for just printing each values, we have to type whole (MonthOFYear[0]) to (MonthOFYear[4]) ,<br />to easily access and print values, now JS provide smart way with help of <strong>Array[] Destructuring :</strong></p>
<pre><code class="language-javascript">// Destructuring with Array :

const MonthOFYear = ["Jan", "Feb", "Mar", "Apr", "May"];

const [Jan, Feb, Mar, Apr, May] = MonthOFYear;

console.log(Jan);
console.log(Feb);
console.log(Mar);
console.log(Apr);
console.log(May);
</code></pre>
<p>now we don't have to write whole <strong>console.log(MonthOFYear[0]);</strong> but we simply write it values vairable name,</p>
<h2><strong>Using Different Variable Names :</strong></h2>
<p>and it not necessary to gave same vairable name to Array, we can use different vairable name also</p>
<pre><code class="language-javascript">const MonthOFYear = ["Jan", "Feb", "Mar", "Apr", "May"];

const [Fist, Sec, third, fourth, fifth] = MonthOFYear;

console.log(Fist);
console.log(Sec);
console.log(third);
console.log(fourth);
console.log(fifth);
</code></pre>
<h3><strong>SKIPPING VAIRABLE VALUES :</strong></h3>
<p>now you only want to gave vairable name to specific values in array and not each values,<br />here we simply skip Feb, Apr ,</p>
<pre><code class="language-javascript">const MonthOFYear = ["Jan", "Feb", "Mar", "Apr", "May"];

const [Jan, , Mar, , May] = MonthOFYear;

console.log(Jan);
console.log(Mar);
console.log(May);
</code></pre>
<h3><strong>SWAPPING THE ELEMENTS :</strong></h3>
<pre><code class="language-javascript">// SWAPPING ELEMENT

let a = 1;
let b = 2;

[a, b] = [b, a];

console.log(a);
console.log(b)
</code></pre>
<h1><strong>2) Object { } Destructuring :</strong></h1>
<p>here also we do same, assigning Object values into separate vairable,</p>
<pre><code class="language-javascript">const Bike = {
  Brand: "Honda",
  Price: 1_000_00,
};

const { Brand, Price } = Bike;

console.log(Brand);
console.log(Price);
</code></pre>
<h3><strong>Using diffent Keys name :</strong></h3>
<p><strong>here, you do not need to use name keys name, you can rename also</strong></p>
<pre><code class="language-javascript">assiging new vairble name,

const { Brand: MyBrand, Price: NewPrice } = Bike;

console.log(MyBrand);
console.log(NewPrice);
</code></pre>
<h1><strong>3) Nested Destructuring</strong></h1>
<p>What if there is object inside object, and we also want to access it ?</p>
<pre><code class="language-javascript">const Job = {
  title: "LockManager",
  salary: 20_000,
  address: {
    city: "Nashik",
    Pin: 422101,
  },
};

const {
  title,
  salary,
  address: { city, pin },
} = Job;
</code></pre>
<p>so what a small explanation blog for your..!</p>
<p>hope this blog help you to understand basic of Destructuring</p>
]]></content:encoded></item></channel></rss>