{"id":70490,"date":"2019-09-13T04:18:50","date_gmt":"2019-09-13T11:18:50","guid":{"rendered":"http:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/"},"modified":"2019-09-13T04:18:50","modified_gmt":"2019-09-13T11:18:50","slug":"a-re-introduction-to-destructuring-assignment","status":"publish","type":"post","link":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/","title":{"rendered":"A Re-Introduction To Destructuring Assignment"},"content":{"rendered":"<link rel=\"canonical\" href=\"https:\/\/www.smashingmagazine.com\/2019\/09\/reintroduction-destructuring-assignment\/\"><title>A Re-Introduction To Destructuring Assignment<\/title><\/p>\n<article>\n<header>\n<h1>A Re-Introduction To Destructuring Assignment<\/h1>\n<address>Laurie Barth<\/address>\n<p>                  <time datetime=\"2019-09-12T14:00:59+02:00\">2019-09-12T14:00:59+02:00<\/time><time datetime=\"2019-09-13T11:06:54+00:00\">2019-09-13T11:06:54+00:00<\/time><\/header>\n<p>If you write JavaScript you\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \u201cdive into\u201d an array or object and reference something inside of it more directly. It usually goes something like this.<\/p>\n<pre><code>const response = {\n   status: 200\n   data: {}\n}\n\n\/\/ instead of response.data we get...\nconst {data} = response \/\/now data references the data object directly\n\n\nconst objectList = [ { key: 'value' }, { key: 'value' }, { key: 'value' } ]\n\n\/\/ instead of objectList[0], objectList[1], etc we get...\nconst [obj, obj1, obj2] = objectList \/\/ now each object can be referenced directly\n<\/code><\/pre>\n<p>However, destructuring assignment is such a powerful piece of syntax that many developers, even those who have been using it since it was first released, forget some of the things it can do. In this post, we\u2019ll go through five real-world examples for both object and array destructuring, sometimes both! And just for fun, I\u2019ll include a wonky example I came across just the other day.<\/p>\n<h3>1. Nested Destructuring<\/h3>\n<p>Being able to access a top-level key inside an object, or the first element of an array is powerful, but it\u2019s also somewhat limiting. It only removes one level of complexity and we still end up with a series of dots or <code>[0]<\/code> references to access what we\u2019re really after.<\/p>\n<p>As it turns out, destructuring can work beyond the top level. And there can be valid reasons for doing so. Take this example of an object response from an HTTP request. We want to go beyond the data object and access just the user. So long as we know the keys we\u2019re looking for, that isn\u2019t a problem.<\/p>\n<div>\n<pre><code>const response = {\n  status: 200,\n  data: { \n    user: {\n       name: 'Rachel', \n      title: 'Editor in Chief' \n    }, \n    account: {},\n    company: 'Smashing Magazine' \n  }\n}\n\nconst {data: {user}} = response \/\/ user is { name: 'Rachel', title: 'Editor in Chief'}<\/code><\/pre>\n<\/div>\n<p>The same can be done with nested arrays. In this case, you don\u2019t need to know the key since there is none. What you need to know is the position of what you\u2019re looking for. You\u2019ll need to provide a reference variable (or comma placeholder) for each element up and until the one you\u2019re looking for (we\u2019ll get to that later). The variable can be named anything since it is not attempting to match a value inside the array.<\/p>\n<div>\n<pre><code>const smashingContributors = [['rachel', ['writer', 'editor', 'reader']], ['laurie', ['writer', 'reader']]]\n\nconst [[rachel, roles]] = smashingContributors\n\/\/ rachel is 'rachel'\n\/\/ roles is [ 'writer', 'editor', 'reader' ]<\/code><\/pre>\n<\/div>\n<p>Keep in mind that these features should be used judiciously, as with any tool. Recognize your use case and the audience of your code base. Consider readability and ease of change down the road. For example, if you\u2019re looking to access a subarray only, perhaps a map would be a better fit.<\/p>\n<div data-component=\"FeaturePanel\" data-audience=\"non-subscriber\" data-remove=\"true\"><\/div>\n<h3>2. Object And Array Destructuring<\/h3>\n<p>Objects and arrays are common data structures. So common, in fact, that one often appears inside the other. Beyond nested destructuring, we can access nested properties even if they are in a different type of data structure than the external one we\u2019re accessing.<\/p>\n<p>Take this example of an array inside an object.<\/p>\n<pre><code>const organization = { \n    users: ['rachel', 'laurie', 'eric', 'suzanne'],\n    name: 'Smashing Magazine',\n    site: 'https:\/\/www.smashingmagazine.com\/' \n}\n\nconst {users:[rachel]} = organization \/\/ rachel is 'rachel'<\/code><\/pre>\n<p>The opposite use case is also valid. An array of objects.<\/p>\n<div>\n<pre><code>const users = [{name: 'rachel', title: 'editor'}, {name: 'laurie', title: 'contributor'}]\n\nconst [{name}] = users \/\/ name is 'rachel'<\/code><\/pre>\n<\/div>\n<p>As it turns out, we have a bit of a problem in this example. We can only access the name of the first user; otherwise, we\u2019ll attempt to use \u2018name\u2019 to reference two different strings, which is invalid. Our next destructuring scenario should sort this out.<\/p>\n<h3>3. Aliases<\/h3>\n<p>As we saw in the above example (when we have repeating keys inside different objects that we want to pull out), we can\u2019t do so in the \u201ctypical\u201d way. Variable names can\u2019t repeat within the same scope (that\u2019s the simplest way of explaining it, it\u2019s obviously more complicated than that).<\/p>\n<div>\n<pre><code>const users = [{name: 'rachel', title: 'editor'}, {name: 'laurie', title: 'contributor'}]\n\nconst [{name: rachel}, {name: laurie}] = users \/\/ rachel is 'rachel' and laurie is 'laurie'<\/code><\/pre>\n<\/div>\n<p>Aliasing is only applicable to objects. That\u2019s because arrays can use any variable name the developer chooses, instead of having to match an existing object key.<\/p>\n<div><\/div>\n<h3>4. Default Values<\/h3>\n<p>Destructuring often assumes that the value it\u2019s referencing is there, but what if it isn\u2019t? It\u2019s never pleasant to litter code with undefined values. That\u2019s when default values come in handy.<\/p>\n<p>Let\u2019s look at how they work for objects.<\/p>\n<pre><code>const user = {name: 'Luke', organization: 'Acme Publishing'}\nconst {name='Brian', role='publisher'} = user\n\/\/ name is Luke\n\/\/ role is publisher<\/code><\/pre>\n<p>If the referenced key already has a value, the default is ignored. If the key does not exist in the object, then the default is used.<\/p>\n<p>We can do something similar for arrays.<\/p>\n<pre><code>const roleCounts = [2]\nconst [editors = 1, contributors = 100] = roleCounts\n\/\/ editors is 2\n\/\/ contributors is 100<\/code><\/pre>\n<p>As with the objects example, if the value exists then the default is ignored. Looking at the above example you may notice that we\u2019re destructuring more elements than exist in the array. What about destructuring fewer elements?<\/p>\n<h3>5. Ignoring Values<\/h3>\n<p>One of the best parts of destructuring is that it allows you to access values that are part of a larger data structure. This includes isolating those values and ignoring the rest of the content, if you so choose.<\/p>\n<p>We actually saw an example of this earlier, but let\u2019s isolate the concept we\u2019re talking about.<\/p>\n<pre><code>const user = {name: 'Luke', organization: 'Acme Publishing'}\nconst {name} = user\n\/\/ name is Luke<\/code><\/pre>\n<p>In this example, we never destructure <code>organization<\/code> and that\u2019s perfectly ok. It\u2019s still available for reference inside the <code>user<\/code> object, like so.<\/p>\n<pre><code>user.organization<\/code><\/pre>\n<p>For arrays, there are actually two ways to \u201cignore\u201d elements. In the objects example we\u2019re specifically referencing internal values by using the associated key name. When arrays are destructured, the variable name is assigned by position. Let\u2019s start with ignoring elements at the end of the array.<\/p>\n<pre><code>const roleCounts = [2, 100, 100000]\nconst [editors, contributors] = roleCounts\n\/\/ editors is 2\n\/\/ contributors is 100<\/code><\/pre>\n<p>We destructure the first and second elements in the array and the rest are irrelevant. But how about later elements? If it\u2019s position based, don\u2019t we have to destructure each element up until we hit the one we want?<\/p>\n<p>As it turns out, we do not. Instead, we use commas to imply the existence of those elements, but without reference variables they\u2019re ignored.<\/p>\n<pre><code>const roleCounts = [2, 100, 100000]\nconst [, contributors, readers] = roleCounts\n\/\/ contributors is 100\n\/\/ readers is 100000<\/code><\/pre>\n<p>And we can do both at the same time. Skipping elements wherever we want by using the comma placeholder. And again, as with the object example, the \u201cignored\u201d elements are still available for reference within the <code>roleCounts<\/code> array.<\/p>\n<div><\/div>\n<h3>Wonky Example<\/h3>\n<p>The power and versatility of destructuring also means you can do some truly bizarre things. Whether they\u2019ll come in handy or not is hard to say, but worth knowing it\u2019s an option!<\/p>\n<p>One such example is that you can use destructuring to make shallow copies.<\/p>\n<pre><code>const obj = {key: 'value', arr: [1,2,3,4]}\nconst {arr, arr: copy} = obj\n\/\/ arr and copy are both [1,2,3,4]<\/code><\/pre>\n<p>Another thing destructuring can be used for is dereferencing.<\/p>\n<pre><code>const obj = {node: {example: 'thing'}}\nconst {node, node: {example}} = obj\n\/\/ node is { example: 'thing' }\n\/\/ example is 'thing'<\/code><\/pre>\n<p>As always, readability is of the utmost importance and all of these examples should be used judicially. But knowing all of your options helps you pick the best one.<\/p>\n<h3>Conclusion<\/h3>\n<p>JavaScript is full of complex objects and arrays. Whether it\u2019s the response from an HTTP request, or static data sets, being able to access the embedded content efficiently is important. Using destructuring assignment is a great way to do that. It not only handles multiple levels of nesting, but it allows for focused access and provides defaults in the case of undefined references.<\/p>\n<p>Even if you\u2019ve used destructuring for years, there are so many details hidden in the spec. I hope that this article acted as a reminder of the tools the language gives you. Next time you\u2019re writing code, maybe one of them will come in handy!<\/p>\n<div>\n  <img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/09\/logo-red-8.png?w=900\" alt=\"Smashing Editorial\"><span>(dm, yk, il)<\/span>\n<\/div>\n<\/article>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A Re-Introduction To Destructuring Assignment A Re-Introduction To Destructuring Assignment Laurie Barth 2019-09-12T14:00:59+02:002019-09-13T11:06:54+00:00 If you write JavaScript you\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \u201cdive into\u201d an array or object and reference something inside&#8230;<a class=\"moretag\" href=\"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/\"> Read the full article&#8230;<\/a><\/p>\n","protected":false},"author":4,"featured_media":70491,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[371],"tags":[],"class_list":["post-70490","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-user-experience"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"A Re-Introduction To Destructuring AssignmentA Re-Introduction To Destructuring Assignment Laurie Barth 2019-09-12T14:00:59+02:002019-09-13T11:06:54+00:00If you write JavaScript you\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \u201cdive into\u201d an array or object and reference something inside of it\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Guest Contribution\"\/>\n\t<meta name=\"keywords\" content=\"user experience\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Design for Immersive Technologies | User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"A Re-Introduction To Destructuring Assignment | Design for Immersive Technologies\" \/>\n\t\t<meta property=\"og:description\" content=\"A Re-Introduction To Destructuring AssignmentA Re-Introduction To Destructuring Assignment Laurie Barth 2019-09-12T14:00:59+02:002019-09-13T11:06:54+00:00If you write JavaScript you\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \u201cdive into\u201d an array or object and reference something inside of it\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-09-13T11:18:50+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-09-13T11:18:50+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"A Re-Introduction To Destructuring Assignment | Design for Immersive Technologies\" \/>\n\t\t<meta name=\"twitter:description\" content=\"A Re-Introduction To Destructuring AssignmentA Re-Introduction To Destructuring Assignment Laurie Barth 2019-09-12T14:00:59+02:002019-09-13T11:06:54+00:00If you write JavaScript you\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \u201cdive into\u201d an array or object and reference something inside of it\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#article\",\"name\":\"A Re-Introduction To Destructuring Assignment | Design for Immersive Technologies\",\"headline\":\"A Re-Introduction To Destructuring Assignment\",\"author\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.taterboy.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/09\\\/logo-red-8.png?fit=60%2C80&ssl=1\",\"width\":60,\"height\":80},\"datePublished\":\"2019-09-13T04:18:50-07:00\",\"dateModified\":\"2019-09-13T04:18:50-07:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#webpage\"},\"articleSection\":\"User Experience\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.taterboy.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"name\":\"User Experience\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"position\":2,\"name\":\"User Experience\",\"item\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#listItem\",\"name\":\"A Re-Introduction To Destructuring Assignment\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#listItem\",\"position\":3,\"name\":\"A Re-Introduction To Destructuring Assignment\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"name\":\"User Experience\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\",\"name\":\"Design for Immersive Technologies\",\"description\":\"User Experience for Games, Virtual Reality (VR) and Augmented\\\/Mixed Reality (AR\\\/MR)\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/\",\"name\":\"Guest Contribution\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d2aad73eb0f48c67b141e9fc978a0e498969791ed623346e361d02d19775b0bb?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Guest Contribution\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#webpage\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/\",\"name\":\"A Re-Introduction To Destructuring Assignment | Design for Immersive Technologies\",\"description\":\"A Re-Introduction To Destructuring AssignmentA Re-Introduction To Destructuring Assignment Laurie Barth 2019-09-12T14:00:59+02:002019-09-13T11:06:54+00:00If you write JavaScript you\\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \\u201cdive into\\u201d an array or object and reference something inside of it\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.taterboy.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/09\\\/logo-red-8.png?fit=60%2C80&ssl=1\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#mainImage\",\"width\":60,\"height\":80},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/09\\\/a-re-introduction-to-destructuring-assignment\\\/#mainImage\"},\"datePublished\":\"2019-09-13T04:18:50-07:00\",\"dateModified\":\"2019-09-13T04:18:50-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/\",\"name\":\"Design for Immersive Technologies\",\"description\":\"User Experience for Games, Virtual Reality (VR) and Augmented\\\/Mixed Reality (AR\\\/MR)\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"A Re-Introduction To Destructuring Assignment | Design for Immersive Technologies","description":"A Re-Introduction To Destructuring AssignmentA Re-Introduction To Destructuring Assignment Laurie Barth 2019-09-12T14:00:59+02:002019-09-13T11:06:54+00:00If you write JavaScript you\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \u201cdive into\u201d an array or object and reference something inside of it","canonical_url":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/","robots":"max-image-preview:large","keywords":"user experience","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#article","name":"A Re-Introduction To Destructuring Assignment | Design for Immersive Technologies","headline":"A Re-Introduction To Destructuring Assignment","author":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"publisher":{"@id":"https:\/\/www.taterboy.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/09\/logo-red-8.png?fit=60%2C80&ssl=1","width":60,"height":80},"datePublished":"2019-09-13T04:18:50-07:00","dateModified":"2019-09-13T04:18:50-07:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#webpage"},"isPartOf":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#webpage"},"articleSection":"User Experience"},{"@type":"BreadcrumbList","@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.taterboy.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","name":"User Experience"}},{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","position":2,"name":"User Experience","item":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#listItem","name":"A Re-Introduction To Destructuring Assignment"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#listItem","position":3,"name":"A Re-Introduction To Destructuring Assignment","previousItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","name":"User Experience"}}]},{"@type":"Organization","@id":"https:\/\/www.taterboy.com\/blog\/#organization","name":"Design for Immersive Technologies","description":"User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","url":"https:\/\/www.taterboy.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author","url":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/","name":"Guest Contribution","image":{"@type":"ImageObject","@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/d2aad73eb0f48c67b141e9fc978a0e498969791ed623346e361d02d19775b0bb?s=96&d=mm&r=g","width":96,"height":96,"caption":"Guest Contribution"}},{"@type":"WebPage","@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#webpage","url":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/","name":"A Re-Introduction To Destructuring Assignment | Design for Immersive Technologies","description":"A Re-Introduction To Destructuring AssignmentA Re-Introduction To Destructuring Assignment Laurie Barth 2019-09-12T14:00:59+02:002019-09-13T11:06:54+00:00If you write JavaScript you\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \u201cdive into\u201d an array or object and reference something inside of it","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.taterboy.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#breadcrumblist"},"author":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"creator":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/09\/logo-red-8.png?fit=60%2C80&ssl=1","@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#mainImage","width":60,"height":80},"primaryImageOfPage":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/#mainImage"},"datePublished":"2019-09-13T04:18:50-07:00","dateModified":"2019-09-13T04:18:50-07:00"},{"@type":"WebSite","@id":"https:\/\/www.taterboy.com\/blog\/#website","url":"https:\/\/www.taterboy.com\/blog\/","name":"Design for Immersive Technologies","description":"User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.taterboy.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Design for Immersive Technologies | User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","og:type":"article","og:title":"A Re-Introduction To Destructuring Assignment | Design for Immersive Technologies","og:description":"A Re-Introduction To Destructuring AssignmentA Re-Introduction To Destructuring Assignment Laurie Barth 2019-09-12T14:00:59+02:002019-09-13T11:06:54+00:00If you write JavaScript you\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \u201cdive into\u201d an array or object and reference something inside of it","og:url":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/","article:published_time":"2019-09-13T11:18:50+00:00","article:modified_time":"2019-09-13T11:18:50+00:00","twitter:card":"summary","twitter:title":"A Re-Introduction To Destructuring Assignment | Design for Immersive Technologies","twitter:description":"A Re-Introduction To Destructuring AssignmentA Re-Introduction To Destructuring Assignment Laurie Barth 2019-09-12T14:00:59+02:002019-09-13T11:06:54+00:00If you write JavaScript you\u2019re likely familiar with ES2015 and all the new language standards that were introduced. One such standard that has seen incredible popularity is destructuring assignment. The ability to \u201cdive into\u201d an array or object and reference something inside of it"},"aioseo_meta_data":{"post_id":"70490","title":null,"description":null,"keywords":null,"keyphrases":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_custom_image_width":null,"og_custom_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"created":"2021-02-07 17:48:29","updated":"2026-09-02 01:44:34","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"twitter_image_url":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.taterboy.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/\" title=\"User Experience\">User Experience<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tA Re-Introduction To Destructuring Assignment\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.taterboy.com\/blog"},{"label":"User Experience","link":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/"},{"label":"A Re-Introduction To Destructuring Assignment","link":"https:\/\/www.taterboy.com\/blog\/2019\/09\/a-re-introduction-to-destructuring-assignment\/"}],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8wzr5-ikW","jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/09\/logo-red-8.png?fit=60%2C80&ssl=1","_links":{"self":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts\/70490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/comments?post=70490"}],"version-history":[{"count":0,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts\/70490\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/media\/70491"}],"wp:attachment":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/media?parent=70490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/categories?post=70490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/tags?post=70490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}