title: Use JavaScript variable as function name?
body: <p>I have the following code in Javascript:</p>
  
  <pre><code>jQuery(document).ready(function(){
      var actions = new Object();
      var actions;
      actions[0] = 'create';
      actions[1] = 'update';
      for (key in actions) {
          // Dialogs
          var actions[key]+Dialog = function(){
              $('#'+actions[key]+'dialog').dialog('destroy');
              $('#'+actions[key]+'dialog').dialog({
                  resizable: false,
                  height:600,
                  width:400,
                  modal: true,
                  buttons: {
                      Cancel: function() {
                          $(this).dialog('close');
                      }
                  }
              });
          };
      }
  });
  </code></pre>
  
  <p>I want to create 2 functions in loop(createDialog and updateDialog). How can i do this? In PHP there is very simple $$var. But how make variable variable in JS I don't know.</p>
  
  <p>Thank you</p>