Write a javascript program that takes a string and returns a new string with capitalized words.
Write a javascript program that takes a string and returns a new string with capitalized words.
253
14-Apr-2023
Updated on 27-Nov-2023
Aryan Kumar
26-Nov-2023Certainly! You can achieve this by splitting the input string into words, capitalizing each word, and then joining them back into a new string. Here's a simple JavaScript program for this:
This capitalizeWords function takes an input string, splits it into an array of words, capitalizes each word, and then joins them back into a new string. The example usage demonstrates how to use the function with a sample input string.