title: return value is undefined in node.js callback function
body: <p>I am writing a callback function in node.js but it is returning me an undefined value. Below is the code</p>
  
  <pre><code>exports.getRecord = (function(callback) {
      return function(req, res) {
          var recordName;
          DBObject.record.find(jsonString, function(err, doc_record) {
              doc_record.forEach(function(docRecordTravel) {
                  recordName = callback(docRecordTravel.recordCode);
                  console.log(recordName);
              })
              }
      })(callbackFunc);
  
      function callbackFunc(recordCode) {
          var recordName;
          DBObject.var_recordRack.find({
              recordID: recordCode
          }, function(err, record) {
              record.forEach(function(recordLoop) {
                  recordName = recordLoop.recordName;
  
              });
              console.log("callback " + recordName);
              return recordName
          });
      }
  </code></pre>
  
  <p>In callbackFunc it is showing me the recordName but when i return it it displays undefined. how can I return the value in call backs in node.js.</p>