Skip to content
the poor coder

Jaden Casing Strings

Poor Man
Published
Reading time
2 min read
On this page

Jaden Casing Strings#

Have you ever encountered a problem where each word in a string needs to be capitalized? Well, Jaden Casing Strings is the solution to that problem.

In my personal experience, I had a blog where I wrote my thoughts and ideas. One day, I wrote a title for my blog post and found that it was not looking professional as all the words in the title were in lowercase. I researched and found the Jaden Casing Strings technique which helped me capitalize each word in the title of my blog post.

What is Jaden Casing Strings?#

Jaden Casing Strings is a technique where each word in a string is capitalized. This technique is named after the famous American actor and rapper, Jaden Smith, who uses this style of capitalization in his tweets and other social media platforms.

How to implement Jaden Casing Strings in HTML?#

To implement Jaden Casing Strings in HTML, we need to use JavaScript. Here is one way to do it:

Text

function jadenCase(str) {
  var words = str.toLowerCase().split(" ");
  for (var i = 0; i < words.length; i++) {
    words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1);
  }
  return words.join(" ");
}

var str = "hello world";
console.log(jadenCase(str)); // Hello World

The above code first splits the string into an array of words using the split() method. It then loops over each word and capitalizes the first letter of each word using the toUpperCase() and slice() methods. Finally, it joins all the words back into a string using the join() method.

Another way to implement Jaden Casing Strings in HTML is by using a CSS property called text-transform. Here is an example:

Text

<style>
  .jaden-case {
    text-transform: capitalize;
  }
</style>

<div class="jaden-case">
  hello world
</div>

The above code uses the CSS property text-transform to capitalize each word in the div element with the class jaden-case. This method is useful when we want to apply the Jaden Casing Strings style to specific elements on a webpage.

Conclusion#

Jaden Casing Strings is a useful technique to capitalize each word in a string. We can implement it in HTML using JavaScript or CSS. It is important to keep our webpage or blog post titles professional-looking, and Jaden Casing Strings is a great solution to achieve that.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC