{"id":19123,"date":"2020-07-06T23:06:55","date_gmt":"2020-07-07T06:06:55","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19123"},"modified":"2023-12-01T03:39:09","modified_gmt":"2023-12-01T11:39:09","slug":"javascript-array","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-array\/","title":{"rendered":"JavaScript Array: A Guide for Beginners"},"content":{"rendered":"\n<p>Let\u2019s create ourselves a list of fruits. We\u2019ll call our list \u201cfruit\u201d, and add the following values: Banana, melon, grapes. Oh, how I love fruit! While this may sound like a tutorial on shopping lists, we\u2019ve actually just created ourselves an array.<br><\/p>\n\n\n\n<p>In this guide, we\u2019re going to walk through what arrays are, how they work, and why you should use them in your code. We\u2019ll discuss a few examples of arrays in action so you can become a JavaScript array ninja!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is an Array?<\/h2>\n\n\n\n<p>An array is an object that stores data. Arrays contain an ordered collection of items, and can store zero or more items. Arrays are useful in programming because they allow you to store similar values in one variable.<br><\/p>\n\n\n\n<p>You don\u2019t have to write ten single variables to list your favorite fruits, for example. With an array, you can add all of your favorite fruits into one variable.<br><\/p>\n\n\n\n<p>Consider the following example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let fruits = [\n\t\"Banana\",\n\t\"Grapes\",\n\t\"Melon\"\n];<\/pre><\/div>\n\n\n\n<p>Here we\u2019ve created an array called \u201cfruits\u201d. It stores three different values, each of which reflects a fruit we want to buy at a grocery store. To declare our array, we\u2019ve surrounded our list of items in square brackets.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Declaring an Array<\/h2>\n\n\n\n<p>There are two ways to declare an array. The way that you\u2019ll see most people do it is by surrounding a list of items with square brackets, like we did earlier:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let berries = [\n\t\"Strawberry\",\n\t\"Blueberry\",\n\t\"Gooseberry\"\n];<\/pre><\/div>\n\n\n\n<p>We\u2019ve declared an array with three values in this example. We can also use the array constructor, which uses the <code>new<\/code> keyword to declare an array:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let berries = new Array(\n\t\"Strawberry\",\n\t\"Blueberry\",\n\t\"Gooseberry\"\n);<\/pre><\/div>\n\n\n\n<p>These code snippets create the same array, but using different methods. Notice that in our second example we\u2019ve used circular brackets to declare our array. We\u2019ve also had to use the <code>new Array<\/code> constructor to declare an array. It\u2019s for that reason that most people prefer the first method; square brackets are much easier to remember and are faster to type.<br><\/p>\n\n\n\n<p>Arrays don\u2019t have to include the same data type. Our array could store any number of different types of data:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let berries = [\n\t\"Strawberry\",\n\t1.50,\n\ttrue\n];<\/pre><\/div>\n\n\n\n<p>This array stores three different types of data: a string, a number, and a boolean. Now that you\u2019re familiar with how to declare an array, you\u2019re ready to start accessing their contents.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Reading an Array<\/h2>\n\n\n\n<p>Arrays wouldn\u2019t be very useful if we couldn\u2019t read their values. That\u2019s why indexing exists. Indexing is a way of accessing individual items in an iterable object, such as a list.<br><\/p>\n\n\n\n<p>Every element of an array in an array is given its own index number. These numbers start with 0, and can be used to access individual items in an array. Remember our \u201cfruits\u201d array?<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let fruits = [\n\t\"Banana\",\n\t\"Grapes\",\n\t\"Melon\"\n];<\/pre><\/div>\n\n\n\n<p>Here are the index values that are assigned to this array:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>0: Banana<\/li>\n\n\n\n<li>1: Grapes<\/li>\n\n\n\n<li>2: Melon<\/li>\n<\/ul>\n\n\n\n<p>By using these numbers, we can access individual items in our list. Let\u2019s say you want to identify which fruit is in index position 1 in your array. You could do so by stating the index value in square brackets after the name of the array:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>fruits[1];<\/pre><\/div>\n\n\n\n<p>Our code returns: Grapes. We\u2019re referring to the index position 1, which stores the value \u201cGrapes\u201d. If you passed the value 0, \u201cBanana\u201d would be returned. If you try to access an item that doesn\u2019t exist, \u201cundefined\u201d will be returned:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>fruits[10];<\/pre><\/div>\n\n\n\n<p>Output: undefined. Where indexing is particularly useful is when you want to loop through the items in an array. Let\u2019s say that you want to print out every fruit in your array to the console. You could do so using a for loop like this:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>for (var i = 0; i &lt; fruits.length; i++) {\n\tconsole.log(fruits[i]);\n}<\/pre><\/div>\n\n\n\n<p>This code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Banana\nGrapes\nMelon<\/pre><\/div>\n\n\n\n<p>Our code loops through every item in our list, then prints each item out to the console. You\u2019ll also notice we\u2019ve used the <code>length<\/code> property. This returns the length of our list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add Items to an Array<\/h2>\n\n\n\n<p>Most of the time, you\u2019ll want to add a new value to an array after you\u2019ve initially declared your array. You can do so using the <code>push()<\/code> array method.<br><\/p>\n\n\n\n<p>We\u2019ve forgotten to add \u201cStrawberry\u201d to our list of fruits. Oh no! Don&#8217;t worry, we can always add it using <code>push()<\/code> method:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let fruits = [\n\t\"Banana\",\n\t\"Grapes\",\n\t\"Melon\"\n];\nfruits.push(\"Strawberry\");\nconsole.log(fruits);<\/pre><\/div>\n\n\n\n<p>Now that we\u2019ve run this code, our array looks like this:<br><\/p>\n\n\n\n<figure class=\"wp-block-table course-info-table\"><table><tbody><tr><td><strong>Banana<\/strong><\/td><td><strong>Grapes<\/strong><\/td><td><strong>Melon<\/strong><\/td><td><strong>Strawberry<\/strong><\/td><\/tr><tr><td>0<\/td><td>1<\/td><td>2<\/td><td>3<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>You can add data to the start of your array using <code>unshift()<\/code>. Strawberries are so important on our shopping list that we want them to appear first:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let fruits = [\n\t\"Banana\",\n\t\"Grapes\",\n\t\"Melon\"\n];\nfruits.push(\"Strawberry\");\nconsole.log(fruits);<\/pre><\/div>\n\n\n\n<p>This would make our original \u201cfruits\u201d list appear like this:<br><\/p>\n\n\n\n<figure class=\"wp-block-table course-info-table\"><table><tbody><tr><td><strong>Strawberry<\/strong><\/td><td><strong>Banana<\/strong><\/td><td><strong>Grapes<\/strong><\/td><td><strong>Melon<\/strong><\/td><\/tr><tr><td>0<\/td><td>1<\/td><td>2<\/td><td>3<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Remove Items from an Array<\/h2>\n\n\n\n<p>It turns out that we\u2019ve already got a melon at home, so we don\u2019t need to shop for one. What would be the point in buying another melon, right? Because melon is at the end of our list, we have two options to remove it:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>splice()<\/code>: Removes elements by their index number.<\/li>\n\n\n\n<li><code>pop()<\/code>: Removes an element from the end of an array.<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s use <code>splice()<\/code> as an example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let fruits = [\n\t\"Banana\",\n\t\"Grapes\",\n\t\"Melon\"\n];\nfruits.splice(3, 1);\nconsole.log(fruits);<\/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>Strawberry\nBanana\nGrapes<\/pre><\/div>\n\n\n\n<p><code>splice()<\/code> accepts two parameters. The first is the index number to be removed from the array, and the second is how many items to remove. In this case, we wanted to remove the item with the index value 3, so we specified \u201c3, 1\u201d as our parameters.<br><\/p>\n\n\n\n<p><code>pop()<\/code> doesn\u2019t accept any parameters. It just removes the last item of a list:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let fruits = [\n\t\"Banana\",\n\t\"Grapes\",\n\t\"Melon\"\n];\nfruits.pop();\nconsole.log(fruits);<\/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>Banana\nGrapes<\/pre><\/div>\n\n\n\n<p>You can also use <code>shift()<\/code> to remove an item from the start of a list:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let fruits = [\n\t\"Banana\",\n\t\"Grapes\",\n\t\"Melon\"\n];\nfruits.shift();\nconsole.log(fruits);<\/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>Grapes\nMelon<\/pre><\/div>\n\n\n\n<p><code>push()<\/code> and <code>unshift()<\/code> add items to lists. <code>pop()<\/code> and <code>shift()<\/code> remove items from lists. The splice method can also be used to remove an item from a list based on its index value.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Changing Items in an Array<\/h2>\n\n\n\n<p>While bananas are a tasty fruit, often they are so big that you can\u2019t eat one just as a snack when you are feeling a little bit peckish. Baby bananas are easier to eat.<br><\/p>\n\n\n\n<p>Now, let\u2019s say that we want to change our \u201cfruits\u201d list so that we shop for baby bananas instead of regular bananas. We could do so using the assignment operator like we would with any variable:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>fruits[0] = \"Baby bananas\";\nconsole.log(fruits);<\/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>Baby bananas\nGrapes\nMelon<\/pre><\/div>\n\n\n\n<p>We\u2019ve modified the item at the index position 0 to store the value \u201cBaby bananas\u201d. You don\u2019t need to use any special methods to make this change; the assignment operator is used to change values in an array.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>That\u2019s the basics of what you need to know about JavaScript arrays. There is more for you to learn, but that&#8217;s what makes programming fun: there\u2019s always a new challenge for you to tackle. If nothing else, you\u2019ve learned about my favorite fruits. Although I\u2019d say that I do love blackcurrants, which I didn\u2019t mention in this tutorial.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to start working with JavaScript arrays like an expert!<\/p>\n","protected":false},"excerpt":{"rendered":"Let\u2019s create ourselves a list of fruits. We\u2019ll call our list \u201cfruit\u201d, and add the following values: Banana, melon, grapes. Oh, how I love fruit! While this may sound like a tutorial on shopping lists, we\u2019ve actually just created ourselves an array. In this guide, we\u2019re going to walk through what arrays are, how they&hellip;","protected":false},"author":240,"featured_media":19124,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-19123","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":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JavaScript Array: A Guide for Beginners | Career Karma<\/title>\n<meta name=\"description\" content=\"Arrays allow you to store multiple similar values in one variable. On Career Karma, learn how to work with arrays in JavaScript.\" \/>\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-array\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Array: A Guide for Beginners\" \/>\n<meta property=\"og:description\" content=\"Arrays allow you to store multiple similar values in one variable. On Career Karma, learn how to work with arrays in JavaScript.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-array\/\" \/>\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-07-07T06:06:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:39:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"679\" \/>\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-array\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript Array: A Guide for Beginners\",\"datePublished\":\"2020-07-07T06:06:55+00:00\",\"dateModified\":\"2023-12-01T11:39:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/\"},\"wordCount\":1133,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-array\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/\",\"name\":\"JavaScript Array: A Guide for Beginners | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg\",\"datePublished\":\"2020-07-07T06:06:55+00:00\",\"dateModified\":\"2023-12-01T11:39:09+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Arrays allow you to store multiple similar values in one variable. On Career Karma, learn how to work with arrays in JavaScript.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-array\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg\",\"width\":1020,\"height\":679,\"caption\":\"Checkboxes written with pen and paper\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-array\/#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 Array: A Guide for Beginners\"}]},{\"@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\/#\/schema\/person\/image\/\",\"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 Array: A Guide for Beginners | Career Karma","description":"Arrays allow you to store multiple similar values in one variable. On Career Karma, learn how to work with arrays in JavaScript.","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-array\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Array: A Guide for Beginners","og_description":"Arrays allow you to store multiple similar values in one variable. On Career Karma, learn how to work with arrays in JavaScript.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-array\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-07T06:06:55+00:00","article_modified_time":"2023-12-01T11:39:09+00:00","og_image":[{"width":1020,"height":679,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-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-array\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-array\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript Array: A Guide for Beginners","datePublished":"2020-07-07T06:06:55+00:00","dateModified":"2023-12-01T11:39:09+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-array\/"},"wordCount":1133,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-array\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-array\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-array\/","url":"https:\/\/careerkarma.com\/blog\/javascript-array\/","name":"JavaScript Array: A Guide for Beginners | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-array\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-array\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg","datePublished":"2020-07-07T06:06:55+00:00","dateModified":"2023-12-01T11:39:09+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Arrays allow you to store multiple similar values in one variable. On Career Karma, learn how to work with arrays in JavaScript.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-array\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-array\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-array\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg","width":1020,"height":679,"caption":"Checkboxes written with pen and paper"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-array\/#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 Array: A Guide for Beginners"}]},{"@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\/#\/schema\/person\/image\/","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\/19123","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=19123"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19123\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/19124"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}