<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dalton Saffe</title>
    <description>The latest articles on DEV Community by Dalton Saffe (@daltonsaffe).</description>
    <link>https://dev.to/daltonsaffe</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%2F98800%2F5807bbd4-30fe-4b42-805f-0212d58a2df4.jpg</url>
      <title>DEV Community: Dalton Saffe</title>
      <link>https://dev.to/daltonsaffe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daltonsaffe"/>
    <language>en</language>
    <item>
      <title>Setting Up Your Dev Environment</title>
      <dc:creator>Dalton Saffe</dc:creator>
      <pubDate>Sat, 03 Jul 2021 03:37:51 +0000</pubDate>
      <link>https://dev.to/daltonsaffe/setting-up-your-dev-environment-12nf</link>
      <guid>https://dev.to/daltonsaffe/setting-up-your-dev-environment-12nf</guid>
      <description>&lt;p&gt;I've compiled a list of sites, tools, and extensions I've enjoyed using for anyone looking to get started on their own development journey.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning
&lt;/h3&gt;

&lt;p&gt;Developing software means learning to learn. Visualization and teaching are the most direct ways to create new neural pathways. Create projects you'd want to use to flex your new skills and sprinkle &lt;a href="https://media.giphy.com/media/26ufl1ASleVkA7wIg/giphy.mp4"&gt;fun&lt;/a&gt; into whatever you're doing. Jim Kwik's &lt;a href="https://www.indiebound.org/book/9781401958237"&gt;Limitless&lt;/a&gt; is worth a read to kickstart your learning journey.&lt;/p&gt;

&lt;p&gt;Tutorials&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/"&gt;freeCodeCamp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.leveluptutorials.com/"&gt;Level Up&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reading &amp;amp; Listening&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/"&gt;dev.to&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.codenewbie.org/"&gt;CodeNewbie&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://syntax.fm/"&gt;Syntax FM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Playing &amp;amp; Prototyping
&lt;/h3&gt;

&lt;p&gt;Sites for when I want to play around or prototype an idea and not have to deal with environment config:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://glitch.com/"&gt;Glitch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://replit.com/"&gt;Replit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://codesandbox.io/"&gt;CodeSandbox&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Terminal
&lt;/h3&gt;

&lt;p&gt;I use the default mac terminal since I enjoy the winky sass the icon serves me and it does everything I want :) shout out to &lt;a href="https://iterm2.com/"&gt;iterm2&lt;/a&gt; as a more fully featured option. I use &lt;a href="https://www.zsh.org/"&gt;zsh&lt;/a&gt; with &lt;a href="https://ohmyz.sh/"&gt;oh my zsh&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Xcode CLI tools: &lt;code&gt;xcode-select —-install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://brew.sh/"&gt;Homebrew&lt;/a&gt; to download system packages&lt;/p&gt;

&lt;h3&gt;
  
  
  Source Control
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://git-scm.com/"&gt;Git&lt;/a&gt; is installed with the Xcode CLI tools which is my source control for code changes. &lt;a href="https://github.com/"&gt;Github&lt;/a&gt; is where I push those changes to collaborate with others. I use &lt;a href="https://about.gitlab.com/"&gt;Gitlab&lt;/a&gt; at work which is also fantastic and offers free private repos. Github is a better place to start on IMO since the open source community is centered around it. You can learn so much from looking at / working on open source software so def have fun with that :)&lt;/p&gt;

&lt;h3&gt;
  
  
  Text Editor
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://code.visualstudio.com/"&gt;VS Code&lt;/a&gt; is fantastic. I love the git tooling where I can clearly review all my changes before committing them and all of the fun extensions that are available.&lt;/p&gt;

&lt;p&gt;Extensions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme"&gt;Material Theme&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=PKief.material-icon-theme"&gt;Material Icons&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint"&gt;EsLint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode"&gt;Prettier&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer"&gt;Live Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer"&gt;Bracket Pair Colorizer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=wix.vscode-import-cost"&gt;Import Cost&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Browsers
&lt;/h3&gt;

&lt;p&gt;You'll want to get familiar with the dev tools in your browser of choice and have multiple browsers to QA your apps on. Get extensions for viewing JSON, React / Vue Dev Tool extensions, and an ad blocker while you're at it ;)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.mozilla.org/en-US/firefox/developer/"&gt;Firefox Developer Edition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.google.com/chrome/"&gt;Chrome&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Servers
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.netlify.com/"&gt;Netlify&lt;/a&gt; is the truth for hosting static sites and a cute place to get started. It has a massive free tier and helpful tooling through a pleasent interface.&lt;/p&gt;

&lt;p&gt;Once you want to start playing around with storing content in a database and creating an API to access it you'll want to explore cloud services such as &lt;a href="https://aws.amazon.com/"&gt;AWS&lt;/a&gt;, &lt;a href="https://www.heroku.com/home"&gt;Heroku&lt;/a&gt;, or &lt;a href="https://www.digitalocean.com/"&gt;DigitalOcean&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;have fun!&lt;/p&gt;

</description>
      <category>tooling</category>
      <category>setup</category>
      <category>vibes</category>
    </item>
    <item>
      <title>ICON Interactive Site Relaunch</title>
      <dc:creator>Dalton Saffe</dc:creator>
      <pubDate>Thu, 16 Jan 2020 20:10:48 +0000</pubDate>
      <link>https://dev.to/daltonsaffe/icon-interactive-site-relaunch-2def</link>
      <guid>https://dev.to/daltonsaffe/icon-interactive-site-relaunch-2def</guid>
      <description>&lt;p&gt;ICON Interactive is a digital agency that's been around for over 20 years so we've seen the crest of various waves of technology. While approaching our site relaunch we wanted to focus on developing a performant site that would showcase our work in a clear, concise manner while also prioritizing performance and the content management experience in the process. We've done just that, so we wanted to share how we did it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F0x52tnptgx1vryraz6ck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F0x52tnptgx1vryraz6ck.png" alt="iconsite"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Make It Fast
&lt;/h3&gt;

&lt;p&gt;We opted to go with a site built around the &lt;a href="https://jamstack.org/" rel="noopener noreferrer"&gt;JAMstack&lt;/a&gt;, which is a modular &amp;amp; performant approach to building websites. It centers around the idea of server-side rendering the site's pages which are then served as code-split payloads with pre-rendered HTML through a CDN. One can also integrate a mesh of services via APIs &amp;amp; framework plugins. This approach removes the need to directly manage web servers that host the site and makes for a performant &amp;amp; secure user experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  Site Framework
&lt;/h3&gt;

&lt;p&gt;ICON enjoys utilizing Vue as our JS framework of choice so we went with &lt;a href="https://gridsome.org/" rel="noopener noreferrer"&gt;Gridsome&lt;/a&gt; as our site's framework since it's based on Vue and has a rich ecosystem of plug-ins &amp;amp; documentation. Gridsome is heavily inspired by &lt;a href="https://www.gatsbyjs.org/" rel="noopener noreferrer"&gt;Gatsby&lt;/a&gt; which is a React-based site framework anyone new to this space should check out.&lt;/p&gt;

&lt;p&gt;Gridsome compiles one's website to code-split payloads with pre-rendered HTML. This differs from a typical site built with Vue or React where the HTML, JS, and CSS are sent as a large bundled javascript file and then parsed on the client's browser. Lots of optimizations are included out of the box - link pre-fetching, image src sets, lazy-loading images, and more. These site generators are the cutting edge of the industry because they dramatically improve site performance &amp;amp; SEO while allowing the developers to use JavaScript frameworks such as React or Vue that they're already familiar with.&lt;/p&gt;

&lt;p&gt;Gridsome pulls in data via GraphQL which offers a unified schema and syntax to manage various sources of data. The tooling around GraphQL is fantastic, there's an included query editor to test queries during the development process which also integrates relevant documentation directly into the interface.&lt;/p&gt;

&lt;h3&gt;
  
  
  CMS
&lt;/h3&gt;

&lt;p&gt;For the content management system we wanted to prioritize ease of use and create a fault-tolerant system for updating the website. We went with &lt;a href="https://forestry.io/" rel="noopener noreferrer"&gt;Forestry&lt;/a&gt; as our CMS since it updates the site by adding the content directly to the github repository as a commit which provides granular logging of each update and allows for version roll-back if needed.&lt;/p&gt;

&lt;p&gt;Forestry's templates are easily customizable to the developer through YAML files. They also provide a GUI interface to modulate and manage templates which is intuitive &amp;amp; flexible. All the images are uploaded directly to a linked AWS S3 bucket via the Forestry interface which relieves bloat on the git repository and provides an integrated, seamless experience for the content editor.&lt;/p&gt;

&lt;p&gt;Forestry is essentially creating and modifying markdown files for the site to ingest at compile time. Each update that is pushed up will take about 2-3 minutes before it is reflected on the live site because the entire site is being recompiled on each update. The benefits gained in site speed &amp;amp; SEO performance from this compilation process are worth it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment
&lt;/h3&gt;

&lt;p&gt;Our site is deployed through &lt;a href="https://aws.amazon.com/amplify/console/" rel="noopener noreferrer"&gt;AWS Amplify&lt;/a&gt; which links to our code repository and provides continuous deployment, which means our site gets rebuilt and deployed each time new commits are pushed to the repository or changes are added through the CMS. Amplify also provides deployment for feature branches so we can test updates of a different git branch before they're merged into the main production branch. The compiled site is then served through the AWS CDN which provides a highly performant way to host &amp;amp; serve the site.&lt;/p&gt;

&lt;h3&gt;
  
  
  Open Source
&lt;/h3&gt;

&lt;p&gt;The site is being built from an open source &lt;a href="https://github.com/iconinteractive" rel="noopener noreferrer"&gt;Github&lt;/a&gt; repository since the Github API has fantastic support for CMS integrations like Forestry. We wanted to open source the site's code to serve as an educational resource for anyone curious to learn more about building websites with the JAMstack.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lighthouse Performance Audit
&lt;/h3&gt;

&lt;p&gt;Our previous site was built on Wordpress and suffered from image bloat which impacted the performance. We're incredibly pleased with the massive jump in performance, accessibility, &amp;amp; SEO from utilizing a JAMstack architecture.&lt;/p&gt;

&lt;p&gt;Previous ICON site:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuabe9zxtr0m5ep4tkf2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuabe9zxtr0m5ep4tkf2m.png" alt="before audit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;New ICON site:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fsz5rihuvbijk3k4gvpa5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fsz5rihuvbijk3k4gvpa5.png" alt="after audit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading! If you're curious to learn more about the JAMstack here's an excellent &lt;a href="https://www.netlify.com/pdf/netlify-whitepaper.pdf" rel="noopener noreferrer"&gt;whitepaper&lt;/a&gt; from Netlify.&lt;/p&gt;

&lt;h3&gt;
  
  
  Links:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://iconinteractive.com/" rel="noopener noreferrer"&gt;https://iconinteractive.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/iconinteractive/icon-interactive-www" rel="noopener noreferrer"&gt;https://github.com/iconinteractive/icon-interactive-www&lt;/a&gt;&lt;/p&gt;

</description>
      <category>jamstack</category>
      <category>gridsome</category>
      <category>forestry</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Destructuring in JavaScript</title>
      <dc:creator>Dalton Saffe</dc:creator>
      <pubDate>Thu, 31 Jan 2019 03:44:16 +0000</pubDate>
      <link>https://dev.to/daltonsaffe/destructuring-in-javascript-37bm</link>
      <guid>https://dev.to/daltonsaffe/destructuring-in-javascript-37bm</guid>
      <description>&lt;p&gt;Hi! This is a brief introduction to destructuring objects &amp;amp; arrays for developers learning modern JavaScript syntax. &lt;/p&gt;

&lt;p&gt;Destructuring is simply a way of extracting &amp;amp; assigning values within objects and arrays to variables. It was standardized by the ECMAScript committee in 2015 for the ES6 release of JavaScript. Destructuring is one of the key ES6 features that will enable developers to trim down verbose syntax and compose modern &amp;amp; legible JavaScript programs.&lt;/p&gt;

&lt;p&gt;Objects in JavaScript are initialized and structured like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="na"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Gaby&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
 &lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Perez&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before ES6 one would extract values into variables one by one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lastName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lastName&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 'Perez'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now with destructuring the variable assignment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;lastName&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 'Perez'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We now have two variables assigned to their respective values from one line of code. Destructuring is a clear &amp;amp; concise way to declare only the variables you need and associate them with a value within the same line. When using destructuring assignments, remember that the variable name and key name should correspond so the program knows which value it needs to access.&lt;/p&gt;

&lt;p&gt;The same extraction pattern applies to arrays in JavaScript. Instead of keys, the variables are declared relative to the index position within the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="nx"&gt;fifty&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;lol&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;82&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lol&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 82&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The destructuring assignment pattern shines when dealing with accessing values within nested object structures.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;student&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Ray Lo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;subjects&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;math&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;B+&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;science&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;math&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;science&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;student&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subjects&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;science&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 'A'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Within the destructuring assignment there’s the target on the left side of the equal sign and the source on the right. This distinction is fundamental to illustrating the next few concepts of this assignment style.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F62pljdkhm8uwp18gfukn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F62pljdkhm8uwp18gfukn.png" alt="source-target-img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Elision
&lt;/h2&gt;

&lt;p&gt;When dealing with arrays it’s possible to skip values with commas in the target so you can access the values you need within an assignment. &lt;/p&gt;

&lt;p&gt;This technique is known as elision which is defined as the omission of a sound or syllable when speaking. My favorite example of elision is "y'all". Back to JavaScript though.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hey&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sup&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;destructuring&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;cool&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 'destructuring is cool'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Default Values
&lt;/h2&gt;

&lt;p&gt;If it’s possible that the value in your object may return as undefined one may assign default values within the target to avoid bugs from popping up in the program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;a&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 200&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 12&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reassignment
&lt;/h2&gt;

&lt;p&gt;It’s also possible to reassign the names of variables within the destructuring target itself. This can be useful for making your variables more semantic for later usage in your program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;HEY&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;wait&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;HOLD UP&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;greeting&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;sup&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;wait&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;chill&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sup&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 'HEY'&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chill&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 'HOLD UP'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Nested Access
&lt;/h2&gt;

&lt;p&gt;Building off the reassignment syntax examined above is the idea of nested access. This pattern is useful for accessing deeply nested objects that contain separate objects that you’d like to extract values from. Absorbing this idea will help keep your code DRY.&lt;/p&gt;

&lt;p&gt;The key difference here is that in the variable after the colon in the target we are wrapping the variable on the right with another pair of braces to access the value stored within. Since that variable name corresponds to an object’s key nested within our parent object we are able to layer the destructuring syntax within itself and access the nested values we need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nestedObj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;students&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
    &lt;span class="na"&gt;autumn&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
      &lt;span class="na"&gt;graduated&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1322&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; 
    &lt;span class="na"&gt;winter&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt; 
      &lt;span class="na"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1337&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;autumn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;graduated&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="na"&gt;winter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nestedObj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;students&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;graduated&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/////&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1322&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/////&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="mi"&gt;1337&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Destructuring is a powerful assignment syntax to make succinct variable declarations and applying this concept in programs will enable one to write elegant, modern JavaScript.&lt;/p&gt;

</description>
      <category>destructuring</category>
      <category>javascript</category>
      <category>es6</category>
    </item>
  </channel>
</rss>
