Basic Algorithm Scripting - Title Case a Sentence

Tell us what’s happening:
Describe your issue in detail here.

I don’t know why pass this code.

Your code so far

function titleCase(str) {
  let arr=str.split(" ");
  let micadena="";
  //arr.forEach(element => console.log(element));
  arr.forEach(element => {
    let primera=element[0].toUpperCase();
    let resto="";
    for (let i=1;i<element.length;i++){
    micadena=micadena+primera+resto+" ";
  return str;

console.log(titleCase("I'm a little tea pot"));
console.log(titleCase("sHoRt AnD sToUt"));
console.log(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT"));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic Algorithm Scripting - Title Case a Sentence

Link to the challenge:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.