title: Passing multiple optional parameters in JavaScript
body: <p>In Lua I've made my own Event system and I wanted to convert and use it in JavaScript, here's the code in Lua:</p>
  
  <pre><code>TriggerEvent = function(Name, ...)
      local EventID = nil;
  
      for Event2ID, Table in pairs(Event) do
          if(Table.Active and Table.Name == Name) then
              EventID = Event2ID;
              break;
          end
      end
  
      if(EventID == nil) then
          return false;
      end
  
      for ListenerID, Table in pairs(Event[EventID].Listener) do
          if(Table.Active) then
              Table.Function(...);
          end
      end
      return true;
  end
  </code></pre>
  
  <p>Which works flawlessly.
  Here's what I have for JavaScript:</p>
  
  <pre><code>TriggerEvent = function(Name, ...) {
      var
          EventID = undefined
      ;
  
      for(Event2ID = 0, Length = Event.length; Event2ID &lt; Length; Event2ID++) {
          if(Event[Event2ID].Active &amp;&amp; Event[Event2ID].Name == Name) {
              EventID = Event2ID;
              break;
          }
      }
  
      if(EventID == undefined) {
          return false;
      }
  
      for(ListenerID = 0, Length = Event[EventID].Listener.length; ListenerID &lt; Length; ListenerID++) {
          if(Event[EventID].Listener[ListenerID].Active) {
              Event[EventID].Listener[ListenerID].Function(...);
          }
      }
      return true;
  }
  </code></pre>
  
  <p>Which doesn't work at all.</p>
  
  <p>Example usage:</p>
  
  <pre><code>WebsiteConnected = function(Website, Test) {
      Website.SetTitle("Hello World");
  
      console.log(Website.GetTitle() + " connected! " + Test);
      return true;
  }
  
  CreateEvent("WebsiteConnected"); // Moved down.
  AddEventListener("WebsiteConnected", WebsiteConnected);
  TriggerEvent("WebsiteConnected", (Website || {}), "Test"); // Moved down.
  </code></pre>