title: Node.js function nested in callback returning not defined error
body: <p>I'm currently working on a route the returns an array which contains the results from two separate calls to the database. Individually the functions I call in the model functions work as intended. However, when I attempt to combine them by calling the second function within the callback of the first I receive an error that the second function "is not a function". Here is the code in my list route. Note util and errorhandler are files I've created to help with the return format and shouldn't be effecting this error. Any help solving this would be appreciated, Thank you!</p>
  
  <p>route/list </p>
  
  <pre><code>router.route("/list/:id").get(function(req, res) {
   list.getListMovie(req.params.id, function(err, list) {
   if (err) {
    res.json(errorHandler.handleDatabaseErrors(err));
    return;
   }
   var response = [];
   response["movies"] = list;
   console.log(response)
   list.getListTV(req.params.id, function(err, list1) {
     if (err) {
       res.json(errorHandler.handleDatabaseErrors(err));
       return;
      }
     response["tv"] = JSON.parse(list1);
     console.log(response)
     res.json(utils.returnFormatForDB(response));
     });
    });
  });
  </code></pre>
  
  <p>the function definitions within models/list</p>
  
  <pre><code>exports.getListTV = function(userid, done) {
   db.get().query('SELECT `idmedia`, `rating`, `title`, `poster_path` FROM 
   `list` JOIN `tv` ON list.idmedia = tv.tv_id WHERE list.idusers = ?', userid, 
   function(err, rows) {
     if (err) return done(err);
     done(null, rows);
   });
  }
  
  exports.getListMovie = function(userid, done) {
   db.get().query('SELECT `idmedia`, `rating`, `title`, `poster_path` FROM 
   `list` JOIN `movies` ON list.idmedia = movies.movie_id WHERE list.idusers = 
   ?', userid, function(err, rows) {
    if (err) return done(err);
    done(null, rows);
   });
  }
  </code></pre>
  
  <p>EDIT:: I'm not sure of the proper way to mark a question as answered but by fixing the list override and making response an object I was able to get my code to work. Thanks for the help!</p>