Javascript function can write to console but not returning value
<p>I have a function in javascript which can write the output to the console but it is unable to return the value.. </p>

<pre><code>fetchData: function(dateToFetch){
            if (mP.viewMode == 1){
                $.each(mealData.DailymPs, function(k, item){
                    if( item.Date == formatDate(mP.chosenDate) ){
                        mP.DayPlan.mPDayData = item;
                        return mP.populateMealDayPlan();
                    }       
                })
            } else if (mP.viewMode == 2){
            //  debugger;
                $.each(mealData.DailymPs, function(k, item){
                    if( item.Date == (dateToFetch) ){
                        mP.DayPlan.mPDayData = item;
                        console.log(mP.populateMealDayPlan());
                        var returnObj = mP.populateMealDayPlan();
                        return returnObj;
                    }       
                })
            }

        }
</code></pre>
