function generateHashtag(str) {
const words = str.split(" ");
for (let i = 0; i < words.length; i++) {
words[i] = words[i][0].toUpperCase() + words[i].substr(1);
}
words.join(" ");
return words
}
console.log(generateHashtag("i am a good coder"))
This is the code I have come up with but after iterating the string, the output is an array with the first words capitalized. How do I join up the words from the array to form back the sentence without the spaces?