{"id":9859,"date":"2020-06-24T21:23:14","date_gmt":"2020-06-25T04:23:14","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=9859"},"modified":"2023-12-01T03:23:23","modified_gmt":"2023-12-01T11:23:23","slug":"javascript-foreach-loop","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/","title":{"rendered":"JavaScript forEach Loops Made Easy"},"content":{"rendered":"\n<p><em>The JavaScript <code>forEach<\/code> loop is an Array method that executes a custom callback function on each item in an array. The <code>forEach<\/code> loop can only be used on Arrays, Sets, and Maps.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>If you\u2019ve spent any time around a programming language, you should have seen a \u201cfor loop.\u201d Using a for loop, you can run through a set of data or a function for a certain number of times. For example, you could have a list of names, also known as an array, and a for loop will go through 100 of those names.<\/p>\n\n\n\n<p>There is a more efficient way to write a for loop if you are working with a collection, like a list or a set. That\u2019s where JavaScript <em>forEach<\/em> loops come in. A forEach loop will run a <a href=\"https:\/\/careerkarma.com\/blog\/javascript-callback\/\">JavaScript callback function<\/a> for each item in a list. Then, the loop stops.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript <strong>for Loop Refresher<\/strong><\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft\"><img loading=\"lazy\" decoding=\"async\" width=\"110\" height=\"125\" src=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/05\/javascript-logo.png\" alt=\"javascript logo\" class=\"wp-image-6904\"\/><\/figure>\n<\/div>\n\n\n<p>The <a href=\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/\">JavaScript for loop<\/a> executes a function a predefined number of times. For loops are useful if you need to run the same block of code multiple times. Using a for loop instead of copying your code helps reduce redundancy. This improves the readability of a code base.<\/p>\n\n\n\n<p>Let&#8217;s write a for loop that prints a value to the console ten times:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>for (i = 0; i &lt;10; i++) {\n\tconsole.log(\u201ctest\u201d)\n}<\/pre><\/div>\n\n\n\n<p>This loop will execute the <code>console.log(\u201ctest\u201d)<\/code> line of code ten times, once for each time the loop is executed.<\/p>\n\n\n\n<p>How does this work? The for loop is split up into three components.<\/p>\n\n\n\n<p>The first component is <em>i = 0.<\/em> This is where we define a <a href=\"https:\/\/careerkarma.com\/blog\/javascript-variables\/\">JavaScript variable<\/a> that keeps track of how many times our loop has been run.<\/p>\n\n\n\n<p>Next, the <em>i &lt; 10<\/em> code defines how many times the loop should be run (in this case, 10). The i++ component executes after each iteration. This component adds one to the &#8220;i&#8221; variable counter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The JavaScript <code>forEach<\/code> Loop<\/strong><\/h2>\n\n\n\n<p>forEach is a <a href=\"https:\/\/careerkarma.com\/blog\/javascript-array\/\">JavaScript Array<\/a> method. It is used to execute a function on each item in an array. Lists, sets, and all other list-like objects support the forEach method.<\/p>\n\n\n\n<p>We&#8217;re going to write a loop that displays a list of companies to the console. Instead of using a for loop, we&#8217;re going to use a forEach loop. This is because we are working with a list of companies.<\/p>\n\n\n\n<p>The following code prints each value from a list of companies to the console:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const companies = [\"Apple\", \"Google\", \"Facebook\"];\ncompanies.forEach(company =&gt; {\n\tconsole.log(company);\n});<\/pre><\/div>\n\n\n\n<p>Our output for our code is as follows:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Apple\nGoogle\nFacebook<\/pre><\/div>\n\n\n\n<p>For each item in our &#8220;companies&#8221; list, we print out the item to the console. This is different to how a regular for loop works.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">JavaScript forEach vs for Loop<\/h3>\n\n\n\n<p>In a traditional for loop, you would have to access each item in the &#8220;companies&#8221; list by <a href=\"https:\/\/careerkarma.com\/blog\/javascript-indexof\/\">list indexing<\/a>. A forEach loop gives you direct access to each item in an array.<\/p>\n\n\n\n<p>Indexing is where you specify the index number of the value you want to access in a list. This index number can be retrieved from the counter that a for loop contains. We discussed this counter earlier.<\/p>\n\n\n\n<p>With a forEach loop, we can access each item in our list individually. In our last example, we created the variable &#8220;company&#8221;. This variable represented an individual company over which our forEach loop was iterating.<\/p>\n\n\n\n<p>forEach loops accept a callback function whereas for loops do not. In a for loop, all of your code is enclosed in the main body of the loop. In a forEach loop, you must write a function which will be executed for each item in the list over which you are iterating.<\/p>\n\n\n\n<iframe loading=\"lazy\" src=\"https:\/\/repl.it\/@careerkarma\/JavaScript-forEach?lite=true\" width=\"100%\" height=\"400px\" frameborder=\"0\"><\/iframe>\n<br>\n<br>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript forEach Callbacks<\/h2>\n\n\n\n<p>The forEach method accepts a callback function. This is a function passed into another function as an argument. Callback functions are executed inside the function in which they appear.<\/p>\n\n\n\n<p>Let&#8217;s go back to our last example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>companies.forEach(company =&gt; {\n\tconsole.log(company);\n});<\/pre><\/div>\n\n\n\n<p>Our callback function comes after the arrow (=&gt;). This arrow denotes an arrow function. But, callback functions do not need to be arrow functions.<\/p>\n\n\n\n<p>We can define the function that we want to execute elsewhere:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const companies = [\"Apple\", \"Google\", \"Facebook\"];\nfunction printValue(company) {\n\tconsole.log(company);\n});\ncompanies.forEach(printValue);<\/pre><\/div>\n\n\n\n<p>In this code, we have defined a new function called printValue. We have passed this function into our forEach loop as an argument.<\/p>\n\n\n\n<p>This function is defined independently of our forEach loop. Our code works because the forEach loop accepts any type of function. We do not need to specify an arrow function.<\/p>\n\n\n\n<p>The advantage of this approach is that our code is easier to read. It is clear that the printValue() function is executed for each item in the &#8220;companies&#8221; list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Tracking the Current Index<\/h2>\n\n\n\n<p>We can track the index value of the list item we are viewing with a forEach method. We can do this by specifying an &#8220;index&#8221; variable in our callback function.<\/p>\n\n\n\n<p>We&#8217;ve decided that we want to see both the index of the company and the contents of the item we are viewing. This can be achieved by adding an &#8220;index&#8221; variable:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const companies = [\"Apple\", \"Google\", \"Facebook\"];\nfunction printValue(company, index) {\n\tconsole.log(`${index}. ${company});\n});\ncompanies.forEach(printValue);<\/pre><\/div>\n\n\n\n<p>Let&#8217;s run our code and see what happens:<\/p>\n\n\n\n<p>0. Apple<\/p>\n\n\n\n<p>1. Google<\/p>\n\n\n\n<p>2. Facebook<\/p>\n\n\n\n<p>We can see both the name of each company and its index value. The &#8220;index&#8221; variable represents each index value.<\/p>\n\n\n\n<p>&#8220;index&#8221; can be named whatever you want, as long as it comes after the first variable in your callback. The first variable is reserved to track the item over which the loop is iterating.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Use Cases of JavaScript forEach<\/strong><\/h2>\n\n\n\n<p>You should use the forEach method if you want to iterate over array items. The map() and reduce() methods are more effective if you need to calculate a result depending on the values of a list.<\/p>\n\n\n\n<p>JavaScript <em>forEach<\/em> loops are most useful when you need to do something with every item in an array in JavaScript, not just a few.<\/p>\n\n\n\n<p>The same applies to <em>for&#8230;in<\/em> loops. If you\u2019re looking to iterate through every object in an array, a <em>for&#8230;in<\/em> loop would work.<\/p>\n\n\n\n<p>On the other hand, if you need to write something more customizable\u2014perhaps with more rules\u2014a \u201cfor loop\u201d may be better.<\/p>\n\n\n\n<p>In addition, <em>forEach<\/em> calls are part of JavaScript 1.6. This means that the forEach method it has browser support across most of the main browsers.<\/p>\n\n\n\n<p>And there you have it: JavaScript <em>forEach<\/em> loops in a nutshell!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"The JavaScript forEach loop is an Array method that executes a custom callback function on each item in an array. The forEach loop can only be used on Arrays, Sets, and Maps. If you\u2019ve spent any time around a programming language, you should have seen a \u201cfor loop.\u201d Using a for loop, you can run&hellip;","protected":false},"author":240,"featured_media":12326,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[12687],"class_list":{"0":"post-9859","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript","8":"tag-tutorial"},"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 forEach Loops Made Easy | Career Karma<\/title>\n<meta name=\"description\" content=\"What if you only want to run the loop once for each name in the array? That\u2019s where JavaScript forEach loops come in.\" \/>\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-foreach-loop\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript forEach Loops Made Easy\" \/>\n<meta property=\"og:description\" content=\"What if you only want to run the loop once for each name in the array? That\u2019s where JavaScript forEach loops come in.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/\" \/>\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-06-25T04:23:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:23:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\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-foreach-loop\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript forEach Loops Made Easy\",\"datePublished\":\"2020-06-25T04:23:14+00:00\",\"dateModified\":\"2023-12-01T11:23:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/\"},\"wordCount\":1022,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.jpg\",\"keywords\":[\"tutorial\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/\",\"name\":\"JavaScript forEach Loops Made Easy | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.jpg\",\"datePublished\":\"2020-06-25T04:23:14+00:00\",\"dateModified\":\"2023-12-01T11:23:23+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"What if you only want to run the loop once for each name in the array? That\u2019s where JavaScript forEach loops come in.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.jpg\",\"width\":1200,\"height\":675,\"caption\":\"JavaScript forEach Loops\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#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 forEach Loops Made Easy\"}]},{\"@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 forEach Loops Made Easy | Career Karma","description":"What if you only want to run the loop once for each name in the array? That\u2019s where JavaScript forEach loops come in.","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-foreach-loop\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript forEach Loops Made Easy","og_description":"What if you only want to run the loop once for each name in the array? That\u2019s where JavaScript forEach loops come in.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-06-25T04:23:14+00:00","article_modified_time":"2023-12-01T11:23:23+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.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-foreach-loop\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript forEach Loops Made Easy","datePublished":"2020-06-25T04:23:14+00:00","dateModified":"2023-12-01T11:23:23+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/"},"wordCount":1022,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.jpg","keywords":["tutorial"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/","url":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/","name":"JavaScript forEach Loops Made Easy | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.jpg","datePublished":"2020-06-25T04:23:14+00:00","dateModified":"2023-12-01T11:23:23+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"What if you only want to run the loop once for each name in the array? That\u2019s where JavaScript forEach loops come in.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/12\/javascript-foreach-loops.jpg","width":1200,"height":675,"caption":"JavaScript forEach Loops"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-foreach-loop\/#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 forEach Loops Made Easy"}]},{"@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\/9859","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=9859"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/9859\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/12326"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=9859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=9859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=9859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}