`Preformatted var mt=" ";
if(num<0){
return console.log(mt);
}
for(var i=0;i<num;i++){
mt+=str;
}
return console.log(mt);
}
What you are doing would put a set of set of double quotes at the end. You don’t need double quotes though. The reason the tests show quotes to denote that the result is a string.
it still does not pass the test??
i messed up copy pasting lost the previous code on topic…
will try to rewrite and post agian.
function titleCase(str) {
var tor=" ";
var temp=str.split(" ");//string to array
for(var i=0; i<temp.length;i++){
// consider "the" at first index in array
var cap=temp[i][0];// Run throught First element of array and save first character "t"
cap=cap.toUpperCase();//Capital first character "T"
var tap=temp[i];// Saving text "the"
tap=tap.slice(1,temp[i].length);//slice first character"he"
tap=tap.toLowerCase();// lower case "he"
tor=tor+(cap+tap+" ");
/* adding Capitalized character"T"+ lowercases text"he"+adding spaces to next element in loop" space"*/
}
return tor; //the code works and does titled text but still not passing the test???
//can any1 help?
}
titleCase("I'm a little tea pot");
titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") ;
It looks like you’re probably adding and extra space at the end.
how to get rid of those space and how do they generate?/
Thank You! for the same.