This one is given i know but im tring to use my head here

This one is given i know but im tring to use my head here
0

#1

Tell us what’s happening:

can anyone tell me why I took this track and if I was close to something

Your code so far

function titleCase(str) {
  var splt = str.toLowerCase().split(" ");
  for (i = 0; i < str.length; i++);
    for (j = 0; j < splt.length; j++);
      if ( str[i].splt[j] = str[i].splt[0]) {
          splt[j] = splt[j].toUpperCase;
          }
  return splt.join(" ");
}
titleCase("I'm a little tea pot");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586.

Link to the challenge:


#2

What are you trying to do with the above if statement? More specifically, what is str[i].splt[j] suppose to represent?

FYI, if you want to compare two values, you need to use the === operator and not the = (assignment operator).


#3

writing a title case function to change every 1st letter to caps


#4

I know what the challenge asks you to do. I was specifically trying to understand what you think the following if statement in your code is supposed to be doing.

if ( str[i].splt[j] = str[i].splt[0]) {