<?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 Sarah Majeed on Medium]]></title>
        <description><![CDATA[Stories by Sarah Majeed on Medium]]></description>
        <link>https://medium.com/@sarahmajeed?source=rss-d33b6268057f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nkM9fXFv0_XlxvzzIK8P9g.jpeg</url>
            <title>Stories by Sarah Majeed on Medium</title>
            <link>https://medium.com/@sarahmajeed?source=rss-d33b6268057f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 18:35:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sarahmajeed/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[LinkedIn 2.0: Everything you need to know about LinkedIn’s new update]]></title>
            <link>https://sarahmajeed.medium.com/linkedin-2-0-everything-you-need-to-know-about-linkedins-new-update-eb707aeb57bb?source=rss-d33b6268057f------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb707aeb57bb</guid>
            <category><![CDATA[strategy]]></category>
            <category><![CDATA[linkedin]]></category>
            <category><![CDATA[growth]]></category>
            <category><![CDATA[career-development]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Sarah Majeed]]></dc:creator>
            <pubDate>Sun, 24 Oct 2021 11:34:23 GMT</pubDate>
            <atom:updated>2021-10-24T11:34:23.270Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*Ong3f0eWWiJymfktiHFa_A.jpeg" /></figure><p>Sure, CV is a great insight into your work, but don’t underestimate the power of LinkedIn. Your profile should speak ABOUT you in all ways and this article is going to cover all aspects.</p><p>First thing you need to know about LinkedIn: It gets crawled by Google SEO. Why does that matter? Any person interested in you or wanting to know about you will search you on Google and you got to make sure your LinkedIn comes first!</p><p><strong>6 WAYS TO STAND OUT ON LINKEDIN:</strong></p><p>1- <strong>Banner (Cover)</strong>: Are you still one of those people with the linked In&#39;s plain default banner? You might want to consider changing it. Fill it with something that has to do with your industry. Best option is to go for a customized banner using Canva.com. You need to make sure that the person landing on your profile gets a flashy overview through your banner.</p><p>2- <strong>Profile Picture: </strong>Your profile picture needs to be clear! Anything other than that is simply unprofessional. Recruiter/visitors need to know your facial identity.</p><p><strong>3-</strong> <strong>Pronunciation: </strong>This is one of the LinkedIn’s new updates. You can add/record your name pronunciation so that people know how to call you. If you feel ‘<em>duh, my name is super simple</em>’, you should still add it.</p><p><strong>4- Connections:</strong> Make sure you connect with the people who belong or are related to your field of interest. The sole purpose of connecting is to find good opportunities, find inspiration to work hard and NETWORK with the right people.</p><p><strong>5-</strong> <strong>Headline: </strong>I can’t stress enough how this headline can help you land the right job or network with the right people. Your headline needs to be small but descriptive enough for a person to scroll through your profile.</p><p><strong>6- About Section:</strong> This stands as the most important section of your profile. If your headline matches the visitor’s interest, they’d want to know more about you. The first three lines should really say to people that this person is good and they go like “I want to read more”. I really love Kim Kaupe’s section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*kH5mDBvXyjuwR3aQprZ2Qw.png" /><figcaption>Kim Kaupe’s LinkedIn about section</figcaption></figure><p>Doesn’t that urge you to click ‘See more’? That’s what your section should do to the reader. Make it interesting, make it creative and make it original!</p><p><strong>BOUNTY SCORING ON LINKEDIN:</strong></p><p>Doing all of the above will help you enhance your profile but um, getting some bounty points doesnt hurt right? So the coming points are for you if you really want the next level growth.</p><p><strong>1- Short Video Intro:</strong></p><p>With the LinkedIn’s new update, you can now add your small video introduction that can be viewed as a story by clicking your profile picture. When you speak and put out your work and interests out there, your profile gets more catchy and people get to know more about you.</p><p><strong>2- Creator Mode:</strong></p><p>Another new addition to LinkedIn is the creator mode. It has been rolled out on most devices.</p><p>With this, you can engage with people in a new way by talking about things you want to talk about. Whatever your area of excellence is, start talking about it. Even if it is your area of fresh learning, why not?</p><p>This mode will add a Follow button on your profile and brings your featured section on top.</p><blockquote>If you’re making content on LinkedIn, make sure you don’t add more than three hashtags. If you think adding as much hashtags is going to increase your reach, it’s wrong. The LinkedIn algorithm will increase the reach with a maximum of 3 hashtags. So be sure of that!</blockquote><p><strong>3- Your LinkedIn Activity:</strong></p><p>What we do on the platform also carries a lot of weight like interesting posts, comments or the things you react on. All that tells the LinkedIn Algorithm what you want to see more.</p><p>Some really nice engagements you can do: <br><strong>a.</strong> <strong>Ask questions:</strong> Go on and comment on posts that interest you. Ask stuff that makes you curious or share something that can benefit other people. LinkedIn is actually a platform for conversation.<br><strong>b.</strong> <strong>Tagging people:</strong> Tag your friends or colleagues in posts. Obviously, only when it makes sense or when it brings them in conversation.</p><blockquote>As the algorithm learns about you, more interesting opportunities come your way.</blockquote><p>Last thing that you should know, specially if you wish to create content on LinkedIn: You should only post the <strong>things you know </strong>or the <strong>things you work on. </strong>Any other thing is irrelevant for the platform.</p><p>With that, I hope after reading this, your next step is upgrading your LinkedIn profiles. Good luck with that!</p><h3>Let’s connect:</h3><p>LinkedIn: <a href="https://www.linkedin.com/in/sarahmajeed/">https://www.linkedin.com/in/sarahmajeed/</a></p><p>Twitter: <a href="https://twitter.com/sarahhmajeed">https://twitter.com/sarahhmajeed</a></p><p>Email: sarahmajeed368@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb707aeb57bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Closures in JavaScript: A Beginner-Friendly Guide]]></title>
            <link>https://javascript.plainenglish.io/closure-in-javascript-3f291eeb8dff?source=rss-d33b6268057f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f291eeb8dff</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sarah Majeed]]></dc:creator>
            <pubDate>Tue, 20 Jul 2021 08:00:49 GMT</pubDate>
            <atom:updated>2021-08-09T04:48:42.127Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve been into technical interviews, you might know how recurring questions related to JavaScript closures are. As for those who’re prepping for it, you’ve landed at the right spot.</p><p>To understand closure, it is important to first look into <strong>local </strong>and <strong>global </strong>variables:</p><h4>Local Variables</h4><p>Local variables are scoped within a function and cannot be accessed outside of it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*WUKBDIqfXafAk7tmntP-rw.png" /><figcaption>locally defined ‘name’ can’t be accessed outside</figcaption></figure><p>This is helpful in reusing variable names without collisions. Some common variables can be <em>result</em>, <em>count</em>, <em>index,</em> etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*2iIPVn7BN4ItnTjJkicfWQ.png" /><figcaption>‘num’ is locally scoped and has different values accordingly</figcaption></figure><h4>Global Variables</h4><p>A function can also access all the variables defined outside the function. The variables defined outside the function belong to the JavaScript window object:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*0Mjpfg4ms2FAtwBOK0-vPA.png" /></figure><p>Here, function foo()<em> </em>can access the<em> globally scoped variable </em><em>num.</em></p><h4>Scope Nesting:</h4><p>What if we nest two functions? In other words, we will be nesting two <strong><em>scopes</em></strong>. For example, innerFunc() is nested inside outerFunc(<em>)</em> as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*weYXbpsJi4beRrZSKxvxJw.png" /></figure><p>Looking at the above code, we see, that the variable outerVar is declared inside the function outerFunc() and accessed inside an inner function innerFunc(). This means that we are able to access the outside scoped variables inside the inner functions.</p><p>It’s fun to know exactly how does javaScript understand that the variable outerVar<strong>,</strong> that is being logged inside the <em>innerFunc()</em>, comes from the <em>outerFunc()</em>? It does that through <strong><em>Lexical Scoping. </em></strong>Lexical scoping simply means that the accessibility of variables is determined by the position of the variables inside the nested scopes. Putting it in simpler terms, this means that the variables declared in the outer scopes can be accessed inside the inner scopes.</p><p>Putting it more simply, through lexical scoping, JavaScript proceeds as follows:</p><ol><li>I see a function outerFunc() that has a variableOuterVar declared.</li><li>Next, I see an innerFunc() nested inside the outerFunc().</li><li>The <em>innerFunc()</em> is trying to access a variable outerVar that does not have any declarations within.</li><li>Since I use lexical scoping, I consider the variable outerVar inside innerFunc()to be the same variable as outerVar of outerFunc().</li></ol><p>What will happen if we have the same variable outerVar declared globally and inside the outerFunc()? Which one will the innerFunc() access?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*KMkjCE97eBcTKc53KaK-nw.png" /></figure><p>As discussed earlier, through lexical scoping, JavaScript will remember the variable declaration inside the outerFunc(). Hence, the ouput will be <em>“Outside”.</em></p><h3>Finally, Closures…</h3><p>Now that we know the basics, we can start talking about closure and wrap it up!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*77-EeFqIQh73pQlq0NK5tw.png" /></figure><p>We can see, the function innerFunc() is now accessed outside of its lexical scope. Can it still access the variable outerVar? Yes, it can. The innerFunc() <strong><em>CLOSES </em></strong>or captures the variable outerVar from its lexical scope. A visual explanation is given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*d2yOidJOyO1ZKwiV9SXyvg.png" /></figure><p>You see that the innerFunc() creates a closure by remembering the variable outerVar<strong> </strong>from its outer scope. No matter where you try to access your innerFunc()<em> </em>now, it’ll remember what it captured.</p><h3>Conclusion</h3><p>For practical examples of closure, I recommend reading the answers here.</p><p><a href="https://stackoverflow.com/questions/2728278/what-is-a-practical-use-for-a-closure-in-javascript">What is a practical use for a closure in JavaScript?</a></p><p>To summarize, a closure is a function that captures variables from its outer scope. It remembers the variables defined in its outer scope no matter where you execute them! I hope this article helps you.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f291eeb8dff" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/closure-in-javascript-3f291eeb8dff">Closures in JavaScript: A Beginner-Friendly Guide</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The do’s and dont’s of LinkedIn]]></title>
            <link>https://sarahmajeed.medium.com/things-you-need-to-know-about-linkedin-if-youre-new-8869f230d16c?source=rss-d33b6268057f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8869f230d16c</guid>
            <category><![CDATA[network]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[linkedin]]></category>
            <category><![CDATA[opportunity]]></category>
            <category><![CDATA[cd]]></category>
            <dc:creator><![CDATA[Sarah Majeed]]></dc:creator>
            <pubDate>Mon, 02 Nov 2020 08:31:23 GMT</pubDate>
            <atom:updated>2020-11-04T06:00:10.860Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*jS2AE6t6nANG6gp1yIzxog.png" /></figure><h3>The do’s and don’ts of LinkedIn</h3><p>If you’re new to LinkedIn, it might seem slightly overwhelming as to how you can start or grow. I am here to help you with that.</p><p>I, myself, got to know the importance of LinkedIn a year after I had my first step into software development. And there are things that I had to discover on my own with time. So, if you’re reading this, I hope it helps.</p><h3><strong>Profile Headline:</strong></h3><p>I can’t stress enough just how important it is. Below is what your profile headline is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*ztGTs9HTLpB3uQmni4XxIg.jpeg" /></figure><p>This will help you reach out to the right people. Remember, LinkedIn has people from various fields and won’t just be related to yours. You have to be loud as to what you do, what major technologies you’re working on to appear in people’s search results. Often times, a recruiter looking for junior/senior/frontend developer, would search with exactly that term.</p><p>What titles are NOT acceptable:</p><ol><li>Passionate/enthusiastic developer — No one, I tell you no one, would search by that. Adjectives like “Passionate” and “enthusiastic” are proven by your work and that’s not what recruiters look for in the first place.</li><li>Tech Geek — This does not sound like something people are looking for. So that’s a big cross too.</li><li>University names — I believe that is already mentioned close to your headline, so that isn’t really needed.</li></ol><p>With that, I am also attaching a link where you can find examples of some of the impactful headlines: <a href="https://www.jobscan.co/blog/impactful-linkedin-headline-examples/">https://www.jobscan.co/blog/impactful-linkedin-headline-examples/</a></p><h3><strong>About:</strong></h3><p>Keep this section very clear. It should be a projection of your work. That’s where, I believe, you can mention your passion and enthusiasm with, obviously, solid proofs. You can mention a summarized list of your skills, past experiences, personal portfolios etc. But all in a concise way. Shouldn’t be too draggy and redundant. Even if, in the beginning, you have very little to mention, go for it! Build yourself with time.</p><blockquote>Remember: You have mentioned all your skills, past work and awards in other sections. So try to highlight only the main key points in your about section.</blockquote><h3><strong>Network:</strong></h3><p>When I came across terms like “Microsoft Student Partner” and “DSC”, I started searching by these two terms. Now you know, how the headline of your profile helps in these cases. All those people associated with these two communities appeared, and it became so much easier for me to connect. Moreover, I also searched for people working at google and Microsoft because that is where my interest mostly lies. You have to look for your interests. I understand, not everyone reading this would be connected to technology.</p><p>This trick proves extremely beneficial because you get to know SO much that is going on in the fields you’re related to such as what influential people are doing, how they’re progressing and different opportunities you can have for yourselves which otherwise, you’d never know.</p><h3><strong>LinkedIn Skill Tests:</strong></h3><p>The coolest thing about LinkedIn is that it allows you to take tests related to the skills you’ve mentioned in your skill section. The first time, I took a skill test, I got a below 70 percentile. It did come as a shocker for me because that skill was the one I was most proud of. I realized, this challenge was really what I needed for myself to grow. LinkedIn doesn’t mention your score on your profile until it’s above 70 percentile so you do have another shot at it. So, it’s one of the BEST practices to test your skills by challenging yourself and solving critical questions.</p><h3><strong>Posting your wins:</strong></h3><p>A lot of people might call LinkedIn toxic, since all you see is people talking about getting great jobs and earning rewards. A lot might call it boasting. Which I agree. How else do you maintain your portfolio? When your posts get more reach, you come in the limelight for recruiters and professional people. Also, potential students who are looking for similar opportunities can connect with you for help.</p><blockquote>I would like to mention that if you reach somewhere high like getting into good companies or getting a chance to globally connect, You should also take it as a responsibility to empower and help as many people as you can.</blockquote><p>One thing you really need to know. No one is going to post their failures regardless of how many they have. The failure posts I have read have only been mentioned after getting the success they wanted. That’s when people are more comfortable talking about it. Therefore, you have to enter LinkedIn with an open mindset. When LinkedIn gets a little bit too overwhelming for me, I take weekly/monthly breaks from it. So, I would suggest the same for you.</p><p>Summing it up, the sooner you dive into LinkedIn, the better. That being said, not everyone on LinkedIn is professional and that is where you draw your line.</p><p>If there are any questions you’d like to ask or any help you want, feel free to email me at sarahmajeed368@gmail.com.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8869f230d16c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Destructuring in ES6]]></title>
            <link>https://sarahmajeed.medium.com/object-destructuring-in-es6-e3165ee374a9?source=rss-d33b6268057f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3165ee374a9</guid>
            <category><![CDATA[destructuring]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[objects]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[objects-in-javascript]]></category>
            <dc:creator><![CDATA[Sarah Majeed]]></dc:creator>
            <pubDate>Fri, 27 Mar 2020 12:39:15 GMT</pubDate>
            <atom:updated>2020-03-27T12:39:15.364Z</atom:updated>
            <content:encoded><![CDATA[<p>What is object destructuring?<strong> Object destructuring is used to extract the property values of an object and assign them to variables.</strong></p><p>Similar to Array destructure, object destructure shares a similar syntax. You just have to replace the square bracket with the curly bracket. (If you haven’t read my previous blog on array destructure, I’d recommend you to read that first). Here, I’ll cover most of the things that you need to know about object destructuring.</p><p>You might already know that to access any <strong><em>property</em></strong> <strong><em>value</em></strong> of an object, the basic syntax is:</p><pre><strong><em>objectname.propertyname</em></strong></pre><p><strong>Extracting property values of an object before destructure:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zC766rYQXnybGUrJSbILEQ.png" /></figure><p>Now this way is going to get extremely annoying when you’ll have to access the values multiple times or when you will be dealing with nested objects.</p><blockquote><strong><em>NOTE:</em></strong></blockquote><blockquote><strong>person</strong><em> is the object name</em></blockquote><blockquote><strong>Name </strong><em>and</em><strong> hobby</strong> <em>are the property names</em></blockquote><blockquote><strong>“Sarah” </strong><em>and</em><strong> “Code”</strong> <em>are the respective property values</em></blockquote><p><strong>Extracting property values of an object after destructure:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E90b-fvS-PYFcix4OPbSug.png" /></figure><p>While destructuring, we have assigned the properties(name and hobby) to the declared object(person). In this way, you can access the values only with the property name! Doesn’t it make the code more simple?</p><h3><strong>DESTRUCTURING WHEN DEALING WITH FUNCTIONS:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4gl2Ay3FqzUdulo7qsb3sg.png" /></figure><p>In the above example, I am passing the entire object(person) as a parameter to the function <strong>logDetails. </strong>Inside the function, I am accessing the values just like we do without using destructure. If I wish to make my code simpler, I can destructure inside the function. But wait… ES6 has a more short and efficient way of doing it</p><p>Why not directly destructure inside the function parenthesis?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iauw6GLy8UytYcheTkBYmw.png" /></figure><p>Inside the parenthesis, where we provide the function parameters, we can add curly braces and write the property names we wish to use inside the function.</p><p>While calling the function, when you pass the object, ES6 will locate the properties present in that object and produce the required values.</p><h3><strong>NESTED OBJECTS:</strong></h3><p>Nested objects tend to get very confusing when dealing with applications. Destructuring proves to be a great help!</p><p><strong>Extracting property values of a nested object before destructuring:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YvmWMPRkuEzf2aScrwnZzA.png" /></figure><p>As you can see, <strong>score </strong>is an object inside of an object <strong>person. </strong>That is what nested objects are. We see that <strong>person.score </strong>is constantly being repeated.</p><p>Constant repetition makes this heavily clustered and totally not readable.</p><p><strong>Extracting property values of a nested object after destructuring:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIq8gZRITtDmBXWLUlmJFQ.png" /></figure><p>On the left hand side, we declare the properties to be accessed (enclosed in curly braces)and on the right hand side, we write the object it is in (In this case, <strong>person.score</strong>).</p><h3><strong>USING NESTED OBJECTS IN FUNCTIONS:</strong></h3><p>Dealing with nested objects in a function is very similar to dealing with normal objects. We use curly braces inside the function parenthesis and declare the properties we want to access. While calling the function, we pass the object where the properties are located in.</p><blockquote>NOTE: maths, english and computerScience are NOT declared directly inside <strong>person. </strong>Rather, they are declared inside <strong>score </strong>object which is inside <strong>person.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fX8a69ufRrOKdAFj7bIZlQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3165ee374a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Array Destructuring in ES6]]></title>
            <link>https://sarahmajeed.medium.com/array-destructuring-in-es6-ee80c0f516fa?source=rss-d33b6268057f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee80c0f516fa</guid>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sarah Majeed]]></dc:creator>
            <pubDate>Sun, 22 Mar 2020 14:05:57 GMT</pubDate>
            <atom:updated>2020-03-22T14:05:57.519Z</atom:updated>
            <content:encoded><![CDATA[<p>What is array destructuring? <strong>An array destructuring assignment is used to extract the values of an iterable object and assign them to the variables.</strong> It is introduced in ES6.</p><p>Destructuring can be done in arrays as well as objects. In this blog, I will be discussing some simple examples of array destructuring that can help you in your JavaScript projects.</p><p>Lets have a look at how people used to extract elements of an array and assign them to variables before destructuring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*zBDuYmqHrbanNQx2dhjFnw.png" /><figcaption>Assigning values to variables in an array</figcaption></figure><p>Now that is where destructuring kicks in. To make the code a lot simpler, we can declare variables in a square bracket (let [a,b]) and assign it to the declared array (In this case, ‘numbers’ or [1,2,3,4,5]). Since array is ordered, logging a and b will automatically give us the first two numbers i.e 1 and 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*cEN1UW9zfx_3YoLE-5SloA.png" /><figcaption>Assigning values to variables in an array</figcaption></figure><p>Now you might be thinking, what if I don’t want to access the elements in order? What if I want to skip several in between? Do I have to keep on declaring new variables for that?</p><p>Here, I have added an additional variable c in order to access the third element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*MtFEAnF6n0o9zBq1bR8rBA.png" /></figure><p>But what if I want to access the fifth element right after the first? Will I continue declaring additional variables? Nah, that is going to be of no use and we do not want that right?</p><p>Why not use just two variables if you want to access just two elements of an array?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*8ucDeKIIRN--sMwpVosufQ.png" /></figure><p>Skipping the place of the elements you don’t want tells the compiler to automatically jump to the next. Cool!</p><blockquote><strong>NOTE: The syntax [a,,b] is similar to let a=numbers[0] and let b=numbers[2] so the only thing destructuring is doing here, is making it short, not making changes to the array or saving memory.</strong></blockquote><p>Similarly, for accessing the first and the fifth element,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*tYAgJFvtCfLrejOG7DA9SQ.png" /></figure><p>The syntax might seem weird if you are new to ES6 but if you look closely, you’ll realize that you just have to skip the places you don’t want!</p><p>While making applications, this comes in very handy since this approach saves your lines of code, makes your code simpler and shorter.</p><p>Similar to array destructuring, object destructuring is equally important and more fun! Stay tuned for my next post regarding object destructuring..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee80c0f516fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>