“Best Finisher”, “Captain Cool”, “Lightening fast hands”. As one sees these phrases, the first person that clicks to the mind is none other than MS Dhoni. MSD has always been given various names like these by his fans. Then the question arises that is he really justifying the names given to him? Or, they are just given on just 2 or 3 performances? We’ll try to figure it out in the sections to come. #MS #Dhoni - One of the finest mind the game of cricket has ever witnessed. His cool and calm composure on and off the field, and his approach to make things simpler has always #motivated me and taught me how to #deal with problems in life. His approach to focus on the #process rather than #outcome has always helped me in #developing new skills. Not a die hard fan of MS Dhoni initially, but got inspired by his very unique Leadership style. - Backing his team members: In spite of many initial failures, he backed Rohit Sharma and Virat Kohli continuously. Today, they are the best batsmen...
Suppose we have following string variable.
var sentence='program to make the first letter of each word in a string as a capital letter';
Now split the sentence into words using array split method.
var uppercase=sentence.split(' ')
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join[' '];
console.log(uppercase);
In above lines sentence.split(' ') separates word using space character and then map functions operate on each element.For each word, the charAt(0) is making the first character to uppercase and then word.slice(1) gives us all characters from the 2nd letter to last and we are combining the results from both and joining each word by a space character and then returning a new array as a result.
Comments