{"id":12576,"date":"2020-07-16T14:38:08","date_gmt":"2020-07-16T21:38:08","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=12576"},"modified":"2023-12-01T03:54:56","modified_gmt":"2023-12-01T11:54:56","slug":"javascript-switch-case","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/","title":{"rendered":"JavaScript Switch Case: A Step-By-Step Guide"},"content":{"rendered":"\n<p><em>The JavaScript switch case is a multiple <code>if else<\/code> statement. It takes a conditional expression just like an if statement but can have many conditions\u2014or cases\u2014that can match the result of the expression to run different blocks of code. <\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Conditional statements are an essential part of programming and are used to control the flow of a computer program. The most common form of conditional statement in JavaScript is the <code>\u201cif\u201d<\/code> and <code>\u201cif...else\u201d<\/code> code block, which can be used to run code only if a certain condition or set of conditions are met.<br><\/p>\n\n\n\n<p>There is another conditional statement built-in to JavaScript that can be used to evaluate an expression against multiple conditions: the switch case statement. Switch case statements can be used to check if a certain condition is met against multiple cases and will run the blocks of code where that condition is met.<br><\/p>\n\n\n\n<p>In this tutorial, we are going to discuss how to use the JavaScript switch expression case statement to create conditional statements. We will also explore how to use multiple cases with the switch statement to create more advanced expressions.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript Conditional Statements Refresher<\/h2>\n\n\n\n<p>Conditional statements allow you to run code if a certain condition is met and not execute a block of code if that condition is not met. Conditional statements evaluate whether a condition is met based on the outcome of a true and false statement.<br><\/p>\n\n\n\n<p>Conditional statements could be useful if you wanted to verify that a user had filled in all the forms on an order page, or to display a message to a user about a product offer only when they are signed in.<br><\/p>\n\n\n\n<p>In JavaScript, the most common form of conditional statement is the <code>\u201cif\u201d <\/code>statement. <code>\u201cif\u201d<\/code> statements evaluate whether a statement is true or false, and only run if the statement evaluates to true. Here\u2019s an example of an if statement in JavaScript:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>var age = 17;\nif (age &gt;= 16) {\n\tconsole.log(\"You are aged 16 or over!\");\n}\n<\/pre><\/div>\n\n\n\n<p>When we run our code, the following output is returned: <code>\u201cYou are aged 16 or over!\u201d<\/code><br><\/p>\n\n\n\n<p>The <code>\u201cif\u201d<\/code> statement also comes with an <code>\u201celse if\u201d<\/code> statement which can be used to check for multiple conditions. If you\u2019re interested in learning more about the JavaScript if and else statements, you can do so by following our <a href=\"https:\/\/careerkarma.com\/blog\/javascript-if-else\">tutorial on \u201cif&#8230;else\u201d statements<\/a>.<br><\/p>\n\n\n\n<p>Now that we know the basics of conditional statements in JavaScript, we can explore the <code>\u201cswitch case\u201d<\/code> statement.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript Switch Case<\/h2>\n\n\n\n<p>The JavaScript <code>\u201cswitch\u201d<\/code> statement evaluates a statement and executes a block of code if that statement evaluates to true. <code>\u201cswitch\u201d<\/code> statements work in a similar way to <code>\u201cif\u201d<\/code> statements in that they check if a statement is true, and run if the statement is equal to true.<\/p>\n\n\n\n<p><code>\u201cswitch\u201d<\/code> statements are written using the following syntax:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>switch (statement) {\n\tcase a:\n\t\t\/\/ Run code\n\t\tbreak;\n\tcase b:\n\t\t\/\/ Run code\n\t\tbreak;\n\tdefault:\n\t\t\/\/ Run code\n\t\tbreak;\n};\n<\/pre><\/div>\n\n\n\n<p>There is a lot going on here, so let\u2019s break it down. This is the procedure our program will follow when reading our <code>\u201cswitch\u201d<\/code> statement:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The switch expression is evaluated when the statement is run.<\/li>\n\n\n\n<li>The value of the statement is compared with each of the cases.<\/li>\n\n\n\n<li>If a case matches our statement, the relevant block of code is run.<\/li>\n\n\n\n<li>If none of our cases are met, the code in the <code>\u201cdefault\u201d<\/code> case block will execute.<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s use an example to illustrate how this works in action. So, let\u2019s say that you are a coffee shop owner who wants to create a program so users can easily check the price of your popular drinks. In our example, we will evaluate the drink a user chooses against our list of coffees, then print out the price of the drink they have selected.<br><\/p>\n\n\n\n<p>Here\u2019s the code we would use to allow users to check the price of your popular drinks:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const drink_name = \"Americano\";\nswitch (drink_name) {\n\tcase \"Americano\":\n\t\tconsole.log(\"The price of an Americano is $2.60\");\n\t\tbreak;\n\tcase \"Cappuccino\":\n\t\tconsole.log(\"The price of a cappuccino is $2.75\");\n\t\tbreak;\n\tcase \"Macchiato\":\n\t\tconsole.log(\"The price of a macchiato is $3.00\");\n\t\tbreak;\n\tcase \"Espresso\":\n\t\tconsole.log(\"The price of an espresso is $2.40\");\n\t\tbreak;\n\tdefault:\n\t\tconsole.log(\"This drink is not available\");\n}\n<\/pre><\/div>\n\n\n\n<p>When we run our program with the variable <code>\u201cdrink_name\u201d <\/code>equal to <code>\u201cAmericano,\u201d<\/code> the following is returned:<br><\/p>\n\n\n\n<p><code>The price of an Americano is $2.60.<br><\/code><\/p>\n\n\n\n<p>If we set <code>\u201cdrink_name\u201d<\/code> to be equal to a different drink, the corresponding price for that drink would appear. In addition, if we had entered an invalid drink name, our code would have returned the contents of our \u201c<code>default\u201d <\/code>statement, which in this case is a message that states <code>\u201cThis drink is not available.\u201d<\/code><br><\/p>\n\n\n\n<p>Notice that we add a <code>\u201cbreak\u201d<\/code> keyword at the end of every case statement. If we don\u2019t include a break statement, our program will keep evaluating statements even after one has been met. This is inefficient, and we use the <code>\u201cbreak case\u201d<\/code> keyword to ensure that when our expression is met, our program stops searching through cases.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript Switch Multiple Cases<\/h2>\n\n\n\n<p>In our above example, we used a single case for each expression, and each expression had a different output. But what if we want to have multiple cases yield the same output?<br><\/p>\n\n\n\n<p>Let\u2019s say that our barista has added two new drinks to the menu, and those drinks cost the same as a macchiato. Instead of writing multiple new cases with their own blocks of code, we can instead use more than one <code>\u201ccase\u201d<\/code> for each block of code.<br><\/p>\n\n\n\n<p>We are going to use the above example to illustrate how to use multiple cases. However, in this example, we are going to change <code>\u201cThe price of [drink name] is [price].\u201d<\/code> to <code>\u201cThe price of this drink is [price].\u201d<\/code> so that we can reuse our console.log() statements.<br><\/p>\n\n\n\n<p>We are also going to add two new drinks, a latte and mocha, each priced at $3.00 (the same as a macchiato).<br><\/p>\n\n\n\n<p>Here is our revised code which includes our new drinks:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>const drink_name = \"Mocha\";\nswitch (drink_name) {\n\tcase \"Americano\":\n\t\tconsole.log(\"The price of this drink is $2.60\");\n\t\tbreak;\n\tcase \"Cappuccino\":\n\t\tconsole.log(\"The price of this drink is $2.75\");\n\t\tbreak;\n\tcase \"Latte\":\n\tcase \"Mocha\":\n\tcase \"Macchiato\":\n\t\tconsole.log(\"The price of this drink is $3.00\");\n\t\tbreak;\n\tcase \"Espresso\":\n\t\tconsole.log(\"The price of this drink is $2.40\");\n\t\tbreak;\n\tdefault:\n\t\tconsole.log(\"This drink is not available\");\n}\n<\/pre><\/div>\n\n\n\n<p>When we run our code above with the <code>\u201cdrink_name\u201d<\/code> variable equal to <code>\u201cMocha,\u201d<\/code> the following response is returned:&nbsp;<br><\/p>\n\n\n\n<p><code>The price of this drink is $3.00.<br><\/code><\/p>\n\n\n\n<p>As you can see, our program has found that \u201cMocha\u201d is listed as a case, and it has run the code in the relevant block.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The <code>\u201cswitch\u201d<\/code> conditional statement can be used to evaluate an expression and return a value depending on whether that expression is met. Switch statements are useful if you want to evaluate a statement against multiple possible outcomes.<br><\/p>\n\n\n\n<p>In this tutorial, we discussed the basics of conditional statements in JavaScript. We then explored how to use the <code>\u201cswitch\u201d<\/code> and <code>\u201ccase\u201d <\/code>statements and went through an example of how to use multiple <code>\u201ccase\u201d <\/code>statements in a<code> \u201cswitch\u201d<\/code> block.<br><\/p>\n\n\n\n<p>Now you have the information you need to use the JavaScript \u201cswitch case\u201d statement like an expert!<\/p>\n","protected":false},"excerpt":{"rendered":"The JavaScript switch case is a multiple if else statement. It takes a conditional expression just like an if statement but can have many conditions\u2014or cases\u2014that can match the result of the expression to run different blocks of code. Conditional statements are an essential part of programming and are used to control the flow of&hellip;","protected":false},"author":240,"featured_media":12577,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-12576","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 Switch Case: A Step-By-Step Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"JavaScript switch case evaluates an expression against multiple different statements. Learn how switch case works on Career Karma.\" \/>\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-switch-case\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Switch Case: A Step-By-Step Guide\" \/>\n<meta property=\"og:description\" content=\"JavaScript switch case evaluates an expression against multiple different statements. Learn how switch case works on Career Karma.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/\" \/>\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-16T21:38:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:54:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"801\" \/>\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-switch-case\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript Switch Case: A Step-By-Step Guide\",\"datePublished\":\"2020-07-16T21:38:08+00:00\",\"dateModified\":\"2023-12-01T11:54:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/\"},\"wordCount\":993,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/\",\"name\":\"JavaScript Switch Case: A Step-By-Step Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.jpg\",\"datePublished\":\"2020-07-16T21:38:08+00:00\",\"dateModified\":\"2023-12-01T11:54:56+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"JavaScript switch case evaluates an expression against multiple different statements. Learn how switch case works on Career Karma.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.jpg\",\"width\":1200,\"height\":801},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#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 Switch Case: A Step-By-Step 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\/#\/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 Switch Case: A Step-By-Step Guide | Career Karma","description":"JavaScript switch case evaluates an expression against multiple different statements. Learn how switch case works on Career Karma.","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-switch-case\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Switch Case: A Step-By-Step Guide","og_description":"JavaScript switch case evaluates an expression against multiple different statements. Learn how switch case works on Career Karma.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-16T21:38:08+00:00","article_modified_time":"2023-12-01T11:54:56+00:00","og_image":[{"width":1200,"height":801,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.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-switch-case\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript Switch Case: A Step-By-Step Guide","datePublished":"2020-07-16T21:38:08+00:00","dateModified":"2023-12-01T11:54:56+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/"},"wordCount":993,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/","url":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/","name":"JavaScript Switch Case: A Step-By-Step Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.jpg","datePublished":"2020-07-16T21:38:08+00:00","dateModified":"2023-12-01T11:54:56+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"JavaScript switch case evaluates an expression against multiple different statements. Learn how switch case works on Career Karma.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-switch-case\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/woman-using-laptop-1181290.jpg","width":1200,"height":801},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-switch-case\/#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 Switch Case: A Step-By-Step 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\/#\/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\/12576","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=12576"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/12576\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/12577"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=12576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=12576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=12576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}