Help|Title Case a Sentence

Tell us what’s happening:
Output is I'm a little tea Pot

Your code so far


function titleCase(str) {
  let nstr=str;
 for(let i=0;i<nstr.length;i++){
   if(nstr.charAt(i)==" "){
     nstr.replace(nstr.charAt(i+1),nstr.charAt(i+1).toUpperCase));}
  }
  return nstr;
}

console.log(titleCase("I'm a little tea pot"));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence/

You’re missing () after toUpperCase. .replace() also doesn’t modify the nstr string, but it generates a new one, so you need to assign it to a variable.

I don’t know why you’re getting that error though