title: says my function is undefined when assigning to a variable
body: <p>i have a problem. I am trying to add a functions return value to a variable but it says the function is undefined. Here is my code. :</p>
  
  <pre><code>var selectedExpenseList = getSelectedExpenseIDs();
  </code></pre>
  
  <p>here is my function:</p>
  
  <pre><code>    function getSelectedExpenseIDs() {
              var selectedExpensesList = new Array;
              var i = 0;
              $('.expenseCheckBox:checked').each(function () {
                  if ($(this)[0].id !== "checkAllExpenses") {
                      selectedExpensesList[i] = $(this)[0].id.split('_')[1];
                      ++i;
                  }
              });
              return selectedExpensesList;
          }
  </code></pre>
  
  <p>EDIT: here is my entire function: I am trying to delete something from a list if a person has checked it.</p>
  
  <pre><code>     var selectedExpenseList;
   function actuallyDeleteTheExpense(canDeleteExpenses) 
   {
       selectedTasksList = getSelectedTaskIDs();
       var deleteTrackers = false, deleteExpenses = false;
  
  
       if (canDeleteExpenses &amp;&amp; !canDeleteTrackers) 
       {
           $.Zebra_Dialog('Do you wish to remove Expenses?', 
           {
               'type': 'question',
               'title': 'Confirmation',
               'buttons': [
                          {
                              caption: 'Yes', callback: function () {
                                  deleteTrackers = false;
                                  deleteExpenses = true;
                                  doTheDelete(deleteExpenses);
                              }
                          },
  
                          {
                              caption: 'No',
                              callback: function () {
                                  doTheDelete(deleteExpenses);
                              }
                          }
                      ]
           });
       }
              }
              function doTheDelete(doIDeleteExpenses) 
              {
                  if (selectedTasksList.length &gt; 0) 
                  {
                      $.ajax({
                          type: "POST",
                          //url: "/Tasks/ViewTasks.aspx/deleteTasksAndLinkedItems",
                          url: '&lt;%=ResolveUrl("~/Expenses/ViewExpenses.aspx/deleteSelectedExpense")%&gt;',
                          data: "{ 'TaskIDs': [" + selectedTasksList.join(',') + "], DeleteTrackers : " + doIDeleteTrackers + ", DeleteExpenses : " + doIDeleteExpenses + " }",
                          //fix data
                          contentType: "application/json; charset=utf-8",
                          dataType: "json",
                          success: function (data) {
                              var ss = data.d;
                              if (ss.length &gt; 0) {
                                  for (var i = 0; i &lt; ss.length; ++i) {
                                      $.noty.consumeAlert({ layout: 'center', type: 'error', dismissQueue: true });
                                      alert(ss[i]);
  
                                  }
                              }
                              $("#viewTasksGrid").flexReload();
                          },
                          error: function (data) {
                              $.noty.consumeAlert({ layout: 'center', type: 'error', dismissQueue: true, modal: true });
                              alert('Error Deleting Tasks');
                              if (window.console) {
                                  console.log(data);
                              }
                          }
                      });
                  } else {
                      showMessage('No tasks are selected.');
                  }
              }
  //end delete expense
  
  
          function getSelectedExpenseIDs() {
              var selectedExpensesList = new Array;
              var i = 0;
              $('.expenseCheckBox:checked').each(function () {
                  if ($(this)[0].id !== "checkAllExpenses") {
                      selectedExpensesList[i] = $(this)[0].id.split('_')[1];
                      ++i;
                  }
              });
              return selectedExpensesList;
          }
  </code></pre>