{"id":11873,"date":"2021-01-07T00:46:49","date_gmt":"2021-01-07T08:46:49","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=11873"},"modified":"2023-12-01T04:07:53","modified_gmt":"2023-12-01T12:07:53","slug":"javascript-string-contains","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/","title":{"rendered":"JavaScript String Contains: Step-By-Step Guide"},"content":{"rendered":"\n<p><em>You can check if a JavaScript string contains a character or phrase using the includes() method, indexOf(), or a regular expression. includes() is the most common method for checking if a string contains a letter or series of letters, and was designed specifically for that purpose.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Checking if a string contains a substring is a common task in any programming language. For instance, say you are building an online game. You may want to check whether a username contains a banned phrase to make sure all usernames are suitable for your game.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript String Contains<\/h2>\n\n\n\n<p>There are three methods for checking if a JavaScript string contains another character or sequence of characters:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>includes().<\/li><li>indexOf().<\/li><li>Regular expressions (regex).<\/li><\/ul>\n\n\n\n<p>In this tutorial, we\u2019re going to discuss methods you can use to check if a JavaScript string contains another string using these three approaches.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">String Contains JavaScript: includes()<\/h3>\n\n\n\n<p>The <a href=\"https:\/\/careerkarma.com\/blog\/javascript-includes\/\">JavaScript includes() method<\/a>, introduced in ES6, determines whether a string contains the characters you have passed into the method. If the string contains certain characters, the method will return \u201ctrue.\u201d <\/p>\n\n\n\n<p>If the specified string does not contain the characters for which you are looking, includes() will return \u201cfalse.\u201d<\/p>\n\n\n\n<p>The syntax for the includes() method is:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>string.includes(word);<\/pre><\/div>\n\n\n\n<p>The value &#8220;string&#8221; refers to the characters through which we will search. &#8220;word&#8221; refers to the characters for which we are looking.<\/p>\n\n\n\n<p>Here\u2019s an example of the includes() method in action:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let example = &quot;Example String!&quot;;\nlet ourSubstring = &quot;Example&quot;;\n\nif (example.includes(ourSubstring)) {\n\tconsole.log(&quot;The word Example is in the string.&quot;);\n} else {\n\tconsole.log(&quot;The word Example is not in the string.&quot;);\n}<\/pre><\/div>\n\n\n\n<p>Our code returns: The word Example is in the string.<\/p>\n\n\n\n<p>On the first two lines, we declare two <a href=\"https:\/\/careerkarma.com\/blog\/javascript-variables\/\">JavaScript variables<\/a>. The first variable is the string through which we want to search. The second is the substring that we want to find in our original string. In other words, we\u2019ll search for whether the first variable contains the contents of the second variable.<\/p>\n\n\n\n<p>Next, we use an if statement to evaluate whether the \u201cexample\u201d variable contains the contents of the \u201courSubstring\u201d variable.<\/p>\n\n\n\n<p>If \u201cexample\u201d contains the word \u201cExample\u201d, our statement evaluates to true. This means that the console.log() statement in the body of our \u201cif\u201d statement is run. Otherwise, our \u201celse\u201d statement is run.<\/p>\n\n\n\n<p>includes() is case-sensitive, so if we changed the case of our substring, \u201cfalse\u201d would be returned.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">includes() Second Argument<\/h4>\n\n\n\n<p>The includes() method lets you specify a second argument. This second argument is the index number at which includes() should start searching for your substring. The first character would have an index of \u201c0\u201d, the second \u201c1\u201d, and so on. This is because lists are indexed from zero.<\/p>\n\n\n\n<p>Let\u2019s check whether the word \u201cExample\u201d appears after the index position 7 in our string:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let example = &quot;Example String!&quot;;\nlet ourSubstring = &quot;Example&quot;;\n\nif (str.includes(ourSubstring, 7)) {\n\tconsole.log(&quot;The word Example is in the string.&quot;);\n} else {\n\tconsole.log(&quot;The word Example is not in the string&quot;);\n}<\/pre><\/div>\n\n\n\n<p>The includes() method returns the index position at which our string begins. Our code returns \u201cThe word Example is not in the string.\u201d While our string does include the word \u201cExample,\u201d the word appears before the index value \u201c7,\u201d which is the space between \u201cExample\u201d and \u201cString!\u201d<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">JavaScript Check if String Contains: indexOf()<\/h3>\n\n\n\n<p>The <a href=\"https:\/\/careerkarma.com\/blog\/javascript-indexof\/\">JavaScript indexOf() method<\/a>, like includes(), checks if a string includes another string. What is different is the output from these two functions.<\/p>\n\n\n\n<p>When we use the includes() method, the method returns a boolean: true or false. indexOf() returns the starting index location of the substring. Or, if the string does not include the substring, we\u2019ll get \u201c-1.\u201d<\/p>\n\n\n\n<p>Let&#8217;s look at the syntax for this method:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>string.indexOf(word);<\/pre><\/div>\n\n\n\n<p>Like in our includes() example, &#8220;string&#8221; refers to the value through which we are searching. &#8220;word&#8221; is the phrase or character for which we are searching.<\/p>\n\n\n\n<p>Here\u2019s an example of indexOf() in JavaScript:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let example = &quot;Example String!&quot;;\nlet ourSubstring = &quot;Example&quot;;\n\nif (example.indexOf(ourSubstring) != 0) {\n\tconsole.log(&quot;The word Example is in the string.&quot;);\n} else {\n\tconsole.log(&quot;The word Example is not in the string.&quot;);\n}\n<\/pre><\/div>\n\n\n\n<p>Our code returns: The word Example is in the string. We have used an \u201cif\u201d statement like we did in our last example. This statement displays a particular message to the console depending on if our string contains a substring.<\/p>\n\n\n\n<p>We check if the indexOf() method does not return -1. If it does, the \u201celse\u201d statement is run. -1 denotes that our string could not be found. Otherwise, the code within our \u201cif\u201d statement is executed.<\/p>\n\n\n\n<p>Let&#8217;s use indexOf() on a string that doesn\u2019t contain a substring:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let str = &quot;Example String!&quot;;\nlet ourSubstring = &quot;Bananas&quot;;\n\nstr.indexOf(ourSubstring);<\/pre><\/div>\n\n\n\n<p>Our code returns -1 because our substring cannot be found.<\/p>\n\n\n\n<p>indexOf(), like the includes() method, is case-sensitive. If we want our search to start at a certain index value, we can use another argument:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let str = &quot;Example String!&quot;;\nlet ourSubstring = &quot;Example&quot;;\n\nstr.indexOf(ourSubstring, 7);<\/pre><\/div>\n\n\n\n<p>Because an exact match is not found starting at the index value seven, our code returns -1.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">String Contains JavaScript: Regex<\/h3>\n\n\n\n<p>We can also make use of <a href=\"https:\/\/careerkarma.com\/blog\/javascript-replace\/\">JavaScript regular expressions<\/a>\u2014or regex\u2014to check if a string contains a substring. Regex can be incredibly useful due to its flexibility: you have a lot of control over what you search for, and where.<\/p>\n\n\n\n<p>We can use the RegExp.test() method to check whether a string contains a substring. Here\u2019s an example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>let str = &quot;Example String!&quot;;\n\n\/Example\/.test(str);\n\n<\/pre><\/div>\n\n\n\n<p>Our code returns true. This is because \u201cJavaScript\u201d is in our \u201cexample\u201d string.<\/p>\n\n\n\n<p>Regex is powerful. The downside to regex is that it can be slower to run depending on what rules you use. The more statements you add to your regex rules, the longer your search will take.<\/p>\n\n\n\n<p>If you\u2019re performing a simple search and have no need for advanced string functions, using includes() or indexOf() may be a better approach. The RegExp.test() method is not recommended for beginners who have not yet learned about Regex.<\/p>\n\n\n\n<p>If you\u2019re looking to learn more about regex and test out your regex, check out <a href=\"https:\/\/regexr.com\/\" target=\"_blank\" rel=\"noopener\" rel=\"nofollow\">RegExr<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>In this tutorial, we discussed the basics of strings in JavaScript. After that, we discussed three ways in which you can check if a string contains a substring in JavaScript: using includes(), indexOf(), and regex.<\/p>\n\n\n\n<p>The includes() method is arguably the most common way of checking if a string contains a substring. This is because the name of the method is literal. It is clear includes() lets you search for a string inside another string.<\/p>\n\n\n\n<p>Are you interested in learning more about JavaScript? We&#8217;ve got you covered. Check out our <a href=\"https:\/\/careerkarma.com\/blog\/how-to-learn-javascript\/\">How to Learn JavaScript article<\/a> for expert learning advice. You&#8217;ll also find a list of top learning resources to help you advance your knowledge.<\/p>\n","protected":false},"excerpt":{"rendered":"You can check if a JavaScript string contains a character or phrase using the includes() method, indexOf(), or a regular expression. includes() is the most common method for checking if a string contains a letter or series of letters, and was designed specifically for that purpose. Checking if a string contains a substring is a&hellip;","protected":false},"author":240,"featured_media":12333,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[12687],"class_list":{"0":"post-11873","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":null,"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 String Contains: Step-By-Step Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"Checking if a string contains a substring is an important function in any programming language. Learn more in this Career Karma article.\" \/>\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-string-contains\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript String Contains: Step-By-Step Guide\" \/>\n<meta property=\"og:description\" content=\"Checking if a string contains a substring is an important function in any programming language. Learn more in this Career Karma article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/\" \/>\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=\"2021-01-07T08:46:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:07:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"JavaScript String Contains: Step-By-Step Guide\",\"datePublished\":\"2021-01-07T08:46:49+00:00\",\"dateModified\":\"2023-12-01T12:07:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/\"},\"wordCount\":1016,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.jpg\",\"keywords\":[\"tutorial\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/\",\"name\":\"JavaScript String Contains: Step-By-Step Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.jpg\",\"datePublished\":\"2021-01-07T08:46:49+00:00\",\"dateModified\":\"2023-12-01T12:07:53+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Checking if a string contains a substring is an important function in any programming language. Learn more in this Career Karma article.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.jpg\",\"width\":1200,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#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 String Contains: 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 String Contains: Step-By-Step Guide | Career Karma","description":"Checking if a string contains a substring is an important function in any programming language. Learn more in this Career Karma article.","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-string-contains\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript String Contains: Step-By-Step Guide","og_description":"Checking if a string contains a substring is an important function in any programming language. Learn more in this Career Karma article.","og_url":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2021-01-07T08:46:49+00:00","article_modified_time":"2023-12-01T12:07:53+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"JavaScript String Contains: Step-By-Step Guide","datePublished":"2021-01-07T08:46:49+00:00","dateModified":"2023-12-01T12:07:53+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/"},"wordCount":1016,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.jpg","keywords":["tutorial"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/","url":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/","name":"JavaScript String Contains: Step-By-Step Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.jpg","datePublished":"2021-01-07T08:46:49+00:00","dateModified":"2023-12-01T12:07:53+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Checking if a string contains a substring is an important function in any programming language. Learn more in this Career Karma article.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/javascript-string-contains\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/javascript-string-contains.jpg","width":1200,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/javascript-string-contains\/#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 String Contains: 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\/11873","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=11873"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/11873\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/12333"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=11873"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=11873"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=11873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}