---
title: "Discussion on \"(JS) Return a string with the first letter of each word capitalized, with the rest of the other word in lower case\" | Hashnode"
description: "Discussion on \"(JS) Return a string with the first letter of each word capitalized, with the rest of the other word in lower case\". Here the code:\nfunction titleCase(str) {\n  let lowArray = str.toLowerCase().split(\" \");\n  let outcome = lowArray.map(function(val){\n    return val.replace(val.charAt(0), val.charAt(0).toUpperCase());\n  });\n  return outcome.join(\" \");\n}\n\nconsole.log(t..."
url: "https://hashnode.com/posts/js-return-a-string-with-the-first-letter-of-each-word-capitalized-with-the-rest-of-the-other-word-in-lower-case/6047cd91c64c63545921c8c4"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [(JS) Return a string with the first letter of each word capitalized, with the rest of the other word in lower case](https://cesaremannino.hashnode.dev/js-return-a-string-with-the-first-letter-of-each-word-capitalized-with-the-rest-of-the-other-word-in-lower-case?utm_source=hashnode&utm_medium=feed)

Here the code: function titleCase(str) { let lowArray = str.toLowerCase().split(" "); let outcome = lowArray.map(function(val){ return val.replace(val.charAt(0), val.charAt(0).toUpperCase()); }); return outcome.join(" "); } console.log(t...

Mar 9, 2021 · 4 min read · cesaremannino.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#algorithms](https://hashnode.com/tag/algorithms)

## Written by

[Cesare](https://hashnode.com/@devmanny)

@devmanny · Cape Town, South Africa

  
[View profile](https://hashnode.com/@devmanny)

Programmer JavaScript and Python

I am developer from Italy living in Cape Town.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
