I have a function that grabs some values from JSON files, and creates an item object.
var searchIndex = [];
function getSearchTerms(param){
  var filePath = 'json/' + param + '.json';
  $.getJSON(filePath, function( data ) {
      var item = {
        param: param,
        title: data.title,
        person: data.fname + ' ' + data.lname
      };
      // console.log(item);
      // searchIndex.push(item);
      return item;
  });
}
I can see the item objects with correct properties being created when I check the console. 
However, when I try to add the objects to searchIndex array, either within the function or within the loop that calls the getSearchTerms function, I get an array with the correct number of rows, but all the values are undefined. 
var contentFiles = [ 'a', 'b', 'c'];
for (var i = 0; i < contentFiles.length; i++) {
    searchIndex.push( getSearchTerms(contentFiles[i]) );
}
What stupid thing am I doing wrong here? Thank you in advance for your help.
 
    