cleanup
This commit is contained in:
parent
1437888823
commit
a9686fba19
@ -1,12 +0,0 @@
|
|||||||
const val = "world HEllo thIs will be capiTalized for each word";
|
|
||||||
function wordsCaps(str) {
|
|
||||||
str = str.toLowerCase();
|
|
||||||
const tempArr = [];
|
|
||||||
let words = str.split(" ");
|
|
||||||
words.forEach(word => {
|
|
||||||
let temp = word.slice(0, 1).toUpperCase() + word.slice(1);
|
|
||||||
tempArr.push(temp);
|
|
||||||
});
|
|
||||||
return tempArr.join(" ");
|
|
||||||
}
|
|
||||||
console.log(wordsCaps(val));
|
|
||||||
Loading…
x
Reference in New Issue
Block a user