{"id":20569,"date":"2020-12-07T22:25:50","date_gmt":"2020-12-08T06:25:50","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=20569"},"modified":"2023-12-01T04:05:43","modified_gmt":"2023-12-01T12:05:43","slug":"javascript-spread-operator","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/","title":{"rendered":"JavaScript Spread Operator: A Guide"},"content":{"rendered":"\n<p><em>avaScript spread operator expands an array in syntax that accepts arguments. The spread operator is commonly used to duplicate objects, merge arrays or pass the contents of a list into a function.<\/em><\/p>\n\n\n\n<p>The spread operator. No, it\u2019s got nothing to do with toast. In JavaScript, the spread operator has a specific meaning: it\u2019s a way to access the contents of an iterable object. While this may not sound as fun as pasting a spread on toast, it\u2019s an incredibly useful tool to know about.\n\n<\/p>\n\n\n\n<p>In this guide, we\u2019re going to talk about the JavaScript spread operator and how it works. We\u2019ll walk through a few examples of common use cases to help you get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is the JavaScript Spread Operator?<\/h2>\n\n\n\n<p>A JavaScript spread operator lets you access the contents of an iterable object. The spread operator is a set of three dots (an ellipsis) followed by the name of the iterable you want to access. This operator was introduced in JavaScript ES6.<\/p>\n\n\n\n<p>The three types of iterable objects are arrays, object literals, and strings. Using a for loop, you can loop through all of these types of data and run a common process on them.<\/p>\n\n\n\n<p>Iterable objects are useful because you can execute the same process on them multiple times. You can loop through a string and replace certain characters. You can loop through an array and create a total of all the values stored in the array.<\/p>\n\n\n\n<p>The syntax for the spread operator is:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var names = [&quot;John&quot;, &quot;Lisa&quot;, &quot;Harry&quot;];\nvar new_names = [...names, &quot;Leslie&quot;];\nconsole.log(new_names);<\/pre><\/div>\n\n\n\n<p>In this syntax, we use &#8230;names to pass the contents of our &#8220;names&#8221; list into a list called &#8220;new_names&#8221;. The &#8220;new_names&#8221; list contains all the items in the &#8220;names&#8221; list, as well as a new name: Leslie.<\/p>\n\n\n\n<p>Three common use cases for the spread operator are to:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Create a copy of an iterable.<\/li><li>Add items to a new iterable.<\/li><li>Pass a list of arguments into a function.<\/li><\/ul>\n\n\n\n<p>The spread syntax represents all the individual elements in a list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Spread Operator JavaScript: Create a Copy of an Iterable<\/h2>\n\n\n\n<p>The spread operator is an effective method of duplicating an iterable. While there are other ways to approach this problem, the spread operator is really easy to use. To create a copy of an iterable, specify three dots and the name of the array you want to create.\n\n<\/p>\n\n\n\n<p>In our last example, we showed how this works with an array. We can also use the spread operator to duplicate JavaScript objects:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const lemon_drizzle = {\n\tname: &quot;Lemon Drizzle&quot;,\n\tprice: 1.95,\n\tvegan: true\n}\n\nconst new_lemon_drizzle = {...lemon_drizzle};\nconsole.log(new_lemon_drizzle);<\/pre><\/div>\n\n\n\n<p>Our code prints the following to the <a href=\"https:\/\/careerkarma.com\/blog\/javascript-console\/\">JavaScript console<\/a>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>{ name: &quot;Lemon Drizzle&quot;, price: 1.95, vegan: true }<\/pre><\/div>\n\n\n\n<p>There are a few important distinctions we need to make in this example. We are creating a copy of a JavaScript object. This means that we need to use curly braces ({}) instead of square brackets ([]).<\/p>\n\n\n\n<p>Second, instead of specifying a single array, we have specified an object. This object contains three keys and values, each of which is related to our \u201cLemon Drizzle\u201d cupcake.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Spread JavaScript: Add Items to a New Iterable<\/h2>\n\n\n\n<p>The use cases of the spread operator don\u2019t stop with copying iterables! There\u2019s more to explore. The spread operator is commonly used to add items from one iterable to the next. Consider the following example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const cupcakes = [\n\t'Lemon Drizzle',\n\t'Chocolate Chip',\n\t'Vanilla Iced'\n];\n\nconst new_cupcakes = [...cupcakes, 'Red Velvet', 'Raspberry Dark Chocolate'];\nconsole.log(new_cupcakes);<\/pre><\/div>\n\n\n\n<p>Our code returns:&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>[&quot;Lemon Drizzle&quot;, &quot;Chocolate Chip&quot;, &quot;Vanilla Iced&quot;, &quot;Red Velvet&quot;, &quot;Raspberry Dark Chocolate&quot;]<\/pre><\/div>\n\n\n\n<p>We\u2019ve created a copy of our original <a href=\"https:\/\/careerkarma.com\/blog\/javascript-array\/\">JavaScript array<\/a> called \u201cnew_cupcakes\u201d, which also includes a few additional values that we\u2019ve created.\n\n<\/p>\n\n\n\n<p>You could use the same syntax to merge two iterables together as well. All you would need to do is specify the two iterables inside square brackets using the spread operator:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const old_menu = [\n\t'Lemon Drizzle',\n\t'Chocolate Chip',\n\t'Vanilla Iced'\n];\n\nconst new_menu = [\n\t'Red Velvet',\n\t'Raspberry Dark Chocolate'\n]\n\nconst final_menu = [...old_menu, ...new_menu];\nconsole.log(final_menu);<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>[&quot;Lemon Drizzle&quot;, &quot;Chocolate Chip&quot;, &quot;Vanilla Iced&quot;, &quot;Red Velvet&quot;, &quot;Raspberry Dark Chocolate&quot;]<\/pre><\/div>\n\n\n\n<p>The same result is returned as from earlier but this time we\u2019ve merged two arrays together.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Spread JavaScript: Passing Arguments to a Function<\/h2>\n\n\n\n<p>When you\u2019re passing multiple arguments into a <a href=\"https:\/\/careerkarma.com\/blog\/how-to-use-javascript-functions\/\">JavaScript function<\/a>, it can be helpful to use the spread operator. Consider this example:\n<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function placeOrder(name, order, price) {\n\tconsole.log('Name: ' + name);\n\tconsole.log('Order: ' + order);\n\tconsole.log('Price: ' + price);\n}\n\nplaceOrder('Geoff', 'Red Velvet', 1.85);<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Name: Geoff\nOrder: Red Velvet\nPrice 1.85<\/pre><\/div>\n\n\n\n<p>We\u2019ve declared a function called <em>placeOrder<\/em><em>()<\/em> that takes in three arguments and prints them to the console. Each value is preceded by a label describing what each argument contains.\n\n<\/p>\n\n\n\n<p>While this code is functional, we could specify our arguments in an array and use the spread operator to pass them into our function:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>function placeOrder(name, order, price) {\n\tconsole.log('Name: ' + name);\n\tconsole.log('Order: ' + order);\n\tconsole.log('Price: ' + price);\n}\n\nconst order = ['Geoff', 'Red Velvet', 1.85];\n\nplaceOrder(...order);<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Name: Geoff\nOrder: Red Velvet\nPrice 1.85<\/pre><\/div>\n\n\n\n<p>The output of this code is the same, but the way our code works is different. Instead of directly passing values to our function, we specify those values in a list. We then use the spread operator to pass those values into our function.<\/p>\n\n\n\n<iframe loading=\"lazy\" src=\"https:\/\/repl.it\/@careerkarma\/JavaScript-Spread-Operator?lite=true\" width=\"100%\" height=\"400px\" frameborder=\"0\"><\/iframe>\n<br>\n<br>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The spread operator is widely used throughout JavaScript. It makes it easy to copy iterable objects, add items to a new iterable, and pass arguments to a function. The syntax for the spread operator is three dots, followed by the iterable object which you want to access.\n\n<\/p>\n\n\n\n<p>Now you\u2019re ready to start using the JavaScript spread operator like a pro!<\/p>\n\n\n\n<p>For advice on top JavaScript learning resources, books, and courses, check out our <a href=\"https:\/\/careerkarma.com\/blog\/how-to-learn-javascript\/\">How to Learn JavaScript article<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"avaScript spread operator expands an array in syntax that accepts arguments. The spread operator is commonly used to duplicate objects, merge arrays or pass the contents of a list into a function. The spread operator. No, it\u2019s got nothing to do with toast. In JavaScript, the spread operator has a specific meaning: it\u2019s a way&hellip;","protected":false},"author":240,"featured_media":20570,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-20569","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"JavaScript","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JavaScript Spread Operator: A Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"The JavaScript spread operator allows you to access items in an iterable object. On Career Karma, learn how to use the spread operator.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Spread Operator: A Guide\" \/>\n<meta property=\"og:description\" content=\"The JavaScript spread operator allows you to access items in an iterable object. On Career Karma, learn how to use the spread operator.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-08T06:25:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:05:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-1IW4HQuauSU-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript Spread Operator: A Guide\",\"datePublished\":\"2020-12-08T06:25:50+00:00\",\"dateModified\":\"2023-12-01T12:05:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/\"},\"wordCount\":826,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/pankaj-patel-1IW4HQuauSU-unsplash.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/\",\"name\":\"JavaScript Spread Operator: A Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/pankaj-patel-1IW4HQuauSU-unsplash.jpg\",\"datePublished\":\"2020-12-08T06:25:50+00:00\",\"dateModified\":\"2023-12-01T12:05:43+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The JavaScript spread operator allows you to access items in an iterable object. On Career Karma, learn how to use the spread operator.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/pankaj-patel-1IW4HQuauSU-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/pankaj-patel-1IW4HQuauSU-unsplash.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript-spread-operator\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript Spread Operator: A Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/jamesgallagher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JavaScript Spread Operator: A Guide | Career Karma","description":"The JavaScript spread operator allows you to access items in an iterable object. On Career Karma, learn how to use the spread operator.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Spread Operator: A Guide","og_description":"The JavaScript spread operator allows you to access items in an iterable object. On Career Karma, learn how to use the spread operator.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-12-08T06:25:50+00:00","article_modified_time":"2023-12-01T12:05:43+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-1IW4HQuauSU-unsplash.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript Spread Operator: A Guide","datePublished":"2020-12-08T06:25:50+00:00","dateModified":"2023-12-01T12:05:43+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/"},"wordCount":826,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-1IW4HQuauSU-unsplash.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/","url":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/","name":"JavaScript Spread Operator: A Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-1IW4HQuauSU-unsplash.jpg","datePublished":"2020-12-08T06:25:50+00:00","dateModified":"2023-12-01T12:05:43+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The JavaScript spread operator allows you to access items in an iterable object. On Career Karma, learn how to use the spread operator.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-1IW4HQuauSU-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/pankaj-patel-1IW4HQuauSU-unsplash.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-spread-operator\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/careerkarma.com\/blog\/javascript\/"},{"@type":"ListItem","position":3,"name":"JavaScript Spread Operator: A Guide"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/20569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=20569"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/20569\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/20570"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=20569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=20569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=20569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}