Basic Algorithm Scripting - Title Case a Sentence

Tell us what’s happening:
Why cannae I pass the tests? I check the returns and they are the same the tests’ desire

Your code so far

function titleCase(minuman) {
   let makanan = minuman.toLowerCase();
   let str = makanan.split(" ");
   let sentence = "";

   for(let i = 0; i < str.length; i++){
     let word = [];

     for(let j = 0; j < str[i].length; j++){
       if(j == 0){
     sentence += word.join("")+" ";
     word = [];
  return sentence;

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

Your browser information:

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

Challenge: Basic Algorithm Scripting - Title Case a Sentence

Link to the challenge:

ohh yeah, you’re right. thank you.

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