Need help for "TItle Case a Sentence" challenge [Resolved]

Hello if someone could help me with my code? I know there are many solutions I can find out from others topics but I don’t want to spoil myself…

just need to know why “typeError: mot.toLowerCase() is not a function” in my code:

var mot = "";
function majMin(mot){
  var minuscule = mot.toLowerCase();
  var separeLettre = minuscule.split("");
  var maj = minuscule[0].toUpperCase();
  var motPropre = minuscule.replace(minuscule[0],maj);
  return motPropre; 
var str = "";
function titleCase(str) {
  var tableau = str.split(" ");
  return majMin(tableau.length);

titleCase("bOnJour jE vous Remercie poUr votre Aide");

thanks for your help !

You’re passing tableau.length to the majMin function, which is a number type. Number types don’t have a .toLowerCase() function.

Also, the variables mot and str aren’t doing anything in your code. The str inside the titleCase function refers to the str parameter between the (), not the str in var str = '';. Same with mot.

Thanks for your help kefvcomedia :wink: