Error: Cannot read property 'Title' of undefined

Tell us what’s happening:

Your code so far

function titleCase(str) {
 var myArr = str.split(" ");
 var kvArray = [{"Title": "value"}, 
               {"Title": "value"}, 
               {"Title": "value"}];
var rating = []; { 
   rating.push({title: kvArray[elem]["Title"]})  })
  return l[i];

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

Your browser information:

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

Link to the challenge:

I think you need to review how a few things in JS work, your code doesn’t really make any sense at all. kvArray in particular: there’s no reason for it. And I don’t think you understand what map does - the line return l[i]; in particular bears no relation to anything that exists in your program.

Can you try to explain what you’re trying to do with your code here, what you think it is doing?