<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nefise on Medium]]></title>
        <description><![CDATA[Stories by Nefise on Medium]]></description>
        <link>https://medium.com/@nefisebikbay?source=rss-5d8399ca6459------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zsP4XnLK4vhrMl_XdvfO4Q.jpeg</url>
            <title>Stories by Nefise on Medium</title>
            <link>https://medium.com/@nefisebikbay?source=rss-5d8399ca6459------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 01:46:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nefisebikbay/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[JavaScript Array Destructuring]]></title>
            <link>https://medium.com/@nefisebikbay/javascript-array-destructuring-474174baca47?source=rss-5d8399ca6459------2</link>
            <guid isPermaLink="false">https://medium.com/p/474174baca47</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[destructuring]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nefise]]></dc:creator>
            <pubDate>Tue, 09 Jun 2026 21:00:19 GMT</pubDate>
            <atom:updated>2026-06-30T11:07:56.476Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*76d3tFkDUIoTeCPvx_5K7A.png" /></figure><p>Hello everyone! In this article, we are going to look at one of JavaScript’s most useful features “destructuring”.</p><p>When working with arrays, you often need to access specific elements. Writing flowers[0], flowers[1] every time works but it quickly becomes unwieldy to always refer to the elements by their index number:</p><pre>const flowers = [&quot;Rose&quot;, &quot;Tulip&quot;, &quot;Daisy&quot;,&quot;Violet&quot;, &quot;Hyacinth&quot;];<br>if (flowers[0] === &quot;Tulip&quot;) {<br>console.log(&#39;The prettiest is Tulip&#39;);<br>} else if (flowers[1] === &quot;Lily&quot;) {<br>console.log(&#39;The prettiest is Lily&#39;);<br>} else {<br>console.log(`${flowers[0]} are prettier than ${flowers[1]}.`);<br>}<br>// Output: Rose are prettier than Tulip.</pre><p>Destructuring lets you give array items their own variable names, so you can use them just like any other variable. It’s the cleanest way to simplify our code:</p><pre>const flowers = [&quot;Rose&quot;, &quot;Tulip&quot;, &quot;Daisy&quot;,&quot;Violet&quot;, &quot;Hyacinth&quot;];<br>const [firstFlower, secondFlower] = flowers;<br>if (firstFlower === &quot;Tulip&quot;) {<br>console.log(&#39;The prettiest is Tulip&#39;);<br>} else if (secondFlower === &quot;Lily&quot;) {<br>console.log(&#39;The prettiest is Lily&#39;);<br>} else {<br>console.log(`${firstFlower} are prettier than ${secondFlower}.`);<br>}<br>// Output: Rose are prettier than Tulip.</pre><p>In this example the first element inside the [], firstFlower, corresponds to the first element in the array, Rose. Similarly, the second element, secondFlower, corresponds to the second item in the array, Tulip. You do not have to destructure every element. If you want to keep the remaining ones together, you can collect them into a new array using ... :</p><pre>const flowers = [&quot;Rose&quot;, &quot;Tulip&quot;, &quot;Daisy&quot;,&quot;Violet&quot;, &quot;Hyacinth&quot;];<br>const [firstFlower, secondFlower, ...remainingFlowers] = flowers;<br>console.log(remainingFlowers);<br>// Output: [&quot;Daisy&quot;, &quot;Violet&quot;, &quot;Hyacinth&quot;]</pre><p>You can also skip elements you do not need. Each comma inside []moves past one position in the array. In the example below, the first two elements are skipped and only the third one is extracted:</p><pre>const flowers = [&quot;Rose&quot;, &quot;Tulip&quot;, &quot;Daisy&quot;,&quot;Violet&quot;, &quot;Hyacinth&quot;];<br>const [, , thirdFlower] = flowers;<br>console.log(thirdFlower);<br>// Output: Daisy</pre><p>The same logic applies when you want to pick elements from multiple positions. Below, only the second and fifth elements are extracted. The commas in between simply skip over the positions that are not needed:</p><pre>const [, secondFlower, , , fifthFlower] = [&#39;Rose&#39;, &#39;Tulip&#39;, &#39;Daisy&#39;, &#39;Violet&#39;, &#39;Hyacinth&#39;];<br>console.log(secondFlower); // Output: Tulip<br>console.log(fifthFlower);  // Output: Hyacinth</pre><p>In this example each comma skips one position. No variable name at that position means that element is ignored.</p><p>Array destructuring is just the beginning. JavaScript also lets you destructure objects, function parameters, and even nested structures. If you’re curious, object destructuring works similarly but uses {} instead of [].</p><p>Source: The examples in this article are inspired by JavaScript modules on the Mimo (mimo.org) platform.</p><p>Note: This syntax works with any iterable in JavaScript, not just arrays — strings, Maps work too.</p><p>See you in the next one!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=474174baca47" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>