Title Case a Sentence - Not accepting the code

Tell us what’s happening:
Hello coders !
I’m getting the following output after I ran the code

As I think I got the correct output from the console but FCC does not accept the code. Can anyone give an idea to solve this. Thanks.

Your code so far

function titleCase(str) {
  
  var lowerCased= str.toLowerCase();
  splitted = lowerCased.split(' ');
  var camelCased = "\"";
  
  for(var i = 0; i< splitted.length; i++){
   camelCased += splitted[i][0].toUpperCase();
    for(var j = 0; j < splitted[i].length-1;j++){
      camelCased += splitted[i][j+1];
    }
    if(i<splitted.length-1){
      camelCased += " ";
    } 
  }
  return camelCased+"\"";
}

titleCase("sHoRt AnD sToUt");```
**Your browser information:**

Your Browser User Agent is: ```Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36```.

**Link to the challenge:**
https://www.freecodecamp.org/challenges/title-case-a-sentence

Why do you need additional quotations for the camelCased variable ?

1 Like

yeah. additional quotations caused the error. Now it works after removing that. Thanks. :+1: