{"id":19992,"date":"2020-07-23T18:36:34","date_gmt":"2020-07-24T01:36:34","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19992"},"modified":"2021-01-04T02:50:54","modified_gmt":"2021-01-04T10:50:54","slug":"js-capitalize-first-letter","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/","title":{"rendered":"JavaScript: Capitalize First Letter of Each Word in a String"},"content":{"rendered":"\n<p><em>There\u2019s many beginner-friendly code challenges that will help you to start thinking more like an engineer. One such challenge is one where you capitalize the first letter of every word in a given string. In this article, we\u2019ll take a look at the prompt and several possible solutions in JavaScript.&nbsp;<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Prompt<\/h2>\n\n\n\n<p>Given a function, <em>capitalize<\/em>, that takes in <em>str<\/em> as a parameter, return that <em>str<\/em> with every word capitalized. Try to think of edge cases in your solution (such as no input, the wrong type of input, etc).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Approach<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>Take a look at the prompt again. Jot down or highlight any keywords that you can find in the wording.&nbsp;<\/li><li>Piece the meaning of the word problem together. Part of the hardest part about doing code challenges is to try to figure out what the problem is asking you to do. Understanding the problem will help you come a long way in being able to solve it.&nbsp;<\/li><li>Pseudocode out a possible solution. It doesn\u2019t have to be real code (it doesn\u2019t have to be executable in your IDE or browser console \u2013 plain English is fine):<\/li><\/ol>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Understand what you're given:\n\tgiven a function\n   \tthat takes some sort of input\n \nUnderstand what you need to return:\n   \ta string\nWhat's the first thing you need to do?\nWhat are some options I can take, knowing that the input is a string?\nIs there string methods I can use?\nHow can I look them up if I don't know what they are?\nWhat do I do if the input is empty or it's a number or object? \nMaybe let's start by writing a for loop to loop through the string.\n \t\tWhat comes next? ... and so on...<\/pre><\/div>\n\n\n\n<p>Thoroughly break the problem step-by-step. It will help you to think of edge cases \u2013 cases where there might be an incorrect input passed or an empty string \u2013 and how to break the problem down into logical steps. This is basically your experimentation phase \u2013 there are no wrong answers, just thoughts about how to approach the problem. Those thoughts can be misguided or misdirected \u2013 that\u2019s how you learn about approaches that <em>won\u2019t<\/em> work to a problem.<\/p>\n\n\n\n<p>I have found that if I can break down the problem by explaining it out loud, the logic comes to me easier. Your mileage may vary on your approach, but I wanted to at least suggest it in case it works for you! The pseudocode for a small problem like this seems to be a little bit much, but if you practice the concept now, it\u2019ll come easier to you when you are working on significantly harder problems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Solutions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Solution #1: split() and for loop with string.replace() and charAt() methods<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n &lt;head&gt;\n   &lt;meta charset=&quot;utf-8&quot;&gt;\n   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;\n   &lt;title&gt;for loop&lt;\/title&gt;\n  \n &lt;\/head&gt;\n &lt;body&gt;\n   &lt;div id=&quot;root&quot;&gt;&lt;\/div&gt;\n  &lt;script async defer&gt;\n    let capitalize = (str) =&gt; {\n      let arr = str.split(' ');\n      for(let i = 0; i &lt; arr.length; i++ ) {\n         arr[i] = arr[i].replace(arr[i].charAt(0),  arr[i].charAt(0).toUpperCase());\n     }\n     return arr.join(' ');\n   }\n   let root = document.getElementById('root');\n   root.innerHTML = JSON.stringify(capitalize('the quick brown fox jumped over the lazy dog'));\n  &lt;\/script&gt;\n &lt;\/body&gt;\n&lt;\/html&gt;<\/pre><\/div>\n\n\n\n<p>In this first solution, we split the string on its spaces. This gives us an arr with each individual word as its own index. Looping over the array gives us the ability to access each string\u2019s personal indexes. We re-assigned the string (the string in this case being arr[i]) at index i to be the outcome of replacing the string character at index 0 (arr[i].charAt(0) with its upper case value. We then rejoined the arr into a string with spaces in between each of the words.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Solution #2: split with map method and slice<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n &lt;head&gt;\n   &lt;meta charset=&quot;utf-8&quot;&gt;\n   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;\n   &lt;title&gt;Map&lt;\/title&gt;\n &lt;\/head&gt;\n &lt;body&gt;\n   &lt;div id=&quot;root&quot;&gt;&lt;\/div&gt;\n  &lt;script async defer&gt;\n    let capitalize = (str) =&gt; {\n      \/\/ split the string on the spaces so that we know what we are working with.\n      let arr = str.split(' ') \/\/ make sure there is a space in between the two quotes here\n      \/\/use the map method\n      arr.map((word, index, array) =&gt; {\n        array[index] = array[index][0].toUpperCase() + array[index].slice(1);\n        return array[index];\n \n      })\n      console.log(arr)\n      return arr.join(' ');\n    }\n   let root = document.getElementById('root');\n   root.innerHTML = JSON.stringify(capitalize('the quick brown fox jumped over the lazy dog'));\n   &lt;\/script&gt;\n &lt;\/body&gt;\n&lt;\/html&gt;<\/pre><\/div>\n\n\n\n<p>In this solution, we start off very similarly, but then we use an ES6 array method called map to loop over the array and return new values that capitalizes the first character of each word. It does this by explicitly laying out what we are going to do with the <code>toUpperCase()<\/code> method for the first letter, the <code>slice()<\/code> method for the rest of the string, and string concatenation to get the new version of the word. We then join the array and return it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Solution #3: regular expressions<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n &lt;head&gt;\n   &lt;meta charset=&quot;utf-8&quot;&gt;\n   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;\n   &lt;title&gt;repl.it&lt;\/title&gt;\n  \n &lt;\/head&gt;\n &lt;body&gt;\n   &lt;div id=&quot;root&quot;&gt;&lt;\/div&gt;\n  &lt;script async defer&gt;\n    let capitalize = (str) =&gt; {\n      let regex = \/(^|\\s)\\S\/g\n       return str.replace(regex, letter =&gt; letter.toUpperCase());\n    }\n   let root = document.getElementById('root');\n   root.innerHTML = JSON.stringify(capitalize('the quick brown fox jumped over the lazy dog'));\n   &lt;\/script&gt;\n &lt;\/body&gt;\n&lt;\/html&gt;<\/pre><\/div>\n\n\n\n<p>In this solution, we use a regular expression to look for all non-whitespace characters ( \\S ) at either the beginning of the string ( ^ ) <em>or <\/em>after a whitespace character ( \\s ). The g flag on the end means global and it allows us to look for all instances of that pattern. Then we use the replace method to replace that regex pattern with a function that takes that letter and returns it to uppercase.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Thoughts<\/h2>\n\n\n\n<p>These solutions are by no means the only solutions to this problem. More than likely, as you start to do more of these, you will come up with solutions that may or may not be different than an article or blog post presents. That\u2019s a good thing. It means you\u2019re starting to think like an engineer \u2013 and that\u2019s the goal.&nbsp;<br><\/p>\n\n\n\n<p>Keep at it. In these solutions, edge cases were not handled. What should you do if your argument is empty or is a number? Try to add to the code above by handling those edge cases.<br><\/p>\n\n\n\n<p><strong><em>Hint<\/em><\/strong>: Use a bang\/exclamation point to conditionally find out if <em>str<\/em> exists. Take a look at the MDN docs to find out if there is a method to find out the <em>type of <\/em>something when you don\u2019t necessarily know what it is.<br><\/p>\n\n\n\n<p><strong><em>One More Thing<\/em><\/strong>: Try your hand at the <a href=\"https:\/\/careerkarma.com\/blog\/javascript-reverse-string\/\">JavaScript Reverse String Code Challenge<\/a> if you haven\u2019t already!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">More Resources to Consider:&nbsp;<\/h3>\n\n\n\n<p><a href=\"https:\/\/careerkarma.com\/blog\/ruby-regex\/\">Using Regular Expressions in Ruby<\/a> \u2013 This is dedicated to Ruby, but regex for the most part is language agnostic \u2013 check it out to learn more about the RegExp syntax in Solution #3.&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/careerkarma.com\/blog\/javascript-replace\/\">JavaScript Replace Text: A Step-By-Step Guide<\/a> \u2013 A tutorial dedicated to the replace method, used in Solution #1.<\/p>\n","protected":false},"excerpt":{"rendered":"There\u2019s many beginner-friendly code challenges that will help you to start thinking more like an engineer. One such challenge is one where you capitalize the first letter of every word in a given string. In this article, we\u2019ll take a look at the prompt and several possible solutions in JavaScript.&nbsp; The Prompt Given a function,&hellip;","protected":false},"author":77,"featured_media":19996,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-19992","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"JavaScript","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JavaScript: Capitalize First Letter of Each Word in a String | Career Karma<\/title>\n<meta name=\"description\" content=\"In this article is a beginner friendly challenge to help you start to think more like an engineer! It\u2019s time to capitalize every word of a given string!\" \/>\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\/js-capitalize-first-letter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript: Capitalize First Letter of Each Word in a String\" \/>\n<meta property=\"og:description\" content=\"In this article is a beginner friendly challenge to help you start to think more like an engineer! It\u2019s time to capitalize every word of a given string!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/\" \/>\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-24T01:36:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-04T10:50:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Christina Kopecky\" \/>\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=\"Christina Kopecky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/\"},\"author\":{\"name\":\"Christina Kopecky\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\"},\"headline\":\"JavaScript: Capitalize First Letter of Each Word in a String\",\"datePublished\":\"2020-07-24T01:36:34+00:00\",\"dateModified\":\"2021-01-04T10:50:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/\"},\"wordCount\":841,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/\",\"name\":\"JavaScript: Capitalize First Letter of Each Word in a String | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg\",\"datePublished\":\"2020-07-24T01:36:34+00:00\",\"dateModified\":\"2021-01-04T10:50:54+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\"},\"description\":\"In this article is a beginner friendly challenge to help you start to think more like an engineer! It\u2019s time to capitalize every word of a given string!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/js-capitalize-first-letter\\\/#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: Capitalize First Letter of Each Word in a String\"}]},{\"@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\\\/ae0cdc4a5d198690d78482646894074e\",\"name\":\"Christina Kopecky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"caption\":\"Christina Kopecky\"},\"description\":\"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.\",\"sameAs\":[\"http:\\\/\\\/www.linkedin.com\\\/in\\\/cmvnk\"],\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/christina-kopecky\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JavaScript: Capitalize First Letter of Each Word in a String | Career Karma","description":"In this article is a beginner friendly challenge to help you start to think more like an engineer! It\u2019s time to capitalize every word of a given string!","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\/js-capitalize-first-letter\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript: Capitalize First Letter of Each Word in a String","og_description":"In this article is a beginner friendly challenge to help you start to think more like an engineer! It\u2019s time to capitalize every word of a given string!","og_url":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-24T01:36:34+00:00","article_modified_time":"2021-01-04T10:50:54+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg","type":"image\/jpeg"}],"author":"Christina Kopecky","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"Christina Kopecky","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/"},"author":{"name":"Christina Kopecky","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"headline":"JavaScript: Capitalize First Letter of Each Word in a String","datePublished":"2020-07-24T01:36:34+00:00","dateModified":"2021-01-04T10:50:54+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/"},"wordCount":841,"commentCount":1,"image":{"@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/","url":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/","name":"JavaScript: Capitalize First Letter of Each Word in a String | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg","datePublished":"2020-07-24T01:36:34+00:00","dateModified":"2021-01-04T10:50:54+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"description":"In this article is a beginner friendly challenge to help you start to think more like an engineer! It\u2019s time to capitalize every word of a given string!","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/syed-ali-74JeU2jfnfk-unsplash-1-e1595487963440.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/js-capitalize-first-letter\/#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: Capitalize First Letter of Each Word in a String"}]},{"@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\/ae0cdc4a5d198690d78482646894074e","name":"Christina Kopecky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","caption":"Christina Kopecky"},"description":"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.","sameAs":["http:\/\/www.linkedin.com\/in\/cmvnk"],"url":"https:\/\/careerkarma.com\/blog\/author\/christina-kopecky\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19992","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\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=19992"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19992\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/19996"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}