JavaScript Double Dollar Sign
<p>I understand the use of the (single) dollar sign in popular JavaScript libraries such as jQuery and Prototype. I also understand the significance of the double dollar sign in PHP (variable variables). Dean Edwards uses the double dollar sign in his famous <strong><a href="http://dean.edwards.name/weblog/2005/10/add-event/">addEvent()</a></strong> JavaScript function. Here is an except containing the use of the double dollar sign:</p>

<pre><code>function addEvent(element, type, handler) {
  // assign each event handler a unique ID
  if (!handler.$$guid) handler.$$guid = addEvent.guid++;
  // create a hash table of event types for the element
  if (!element.events) element.events = {};
  // create a hash table of event handlers for each element/event pair
  var handlers = element.events[type];
  if (!handlers) {
    handlers = element.events[type] = {};
    // store the existing event handler (if there is one)
    if (element["on" + type]) {
      handlers[0] = element["on" + type];
    }
  }
  // store the event handler in the hash table
  handlers[handler.$$guid] = handler;
  // assign a global event handler to do all the work
  element["on" + type] = handleEvent;
};
// a counter used to create unique IDs
addEvent.guid = 1;
</code></pre>

<p>From what I've read, the dollar sign only officially has significance in JavaScript for code generation tools, although that standard is largely ignored today due to the dollar signs widespread usage in the aforementioned JavaScript libraries. </p>

<p>Can anyone shed any light on this usage of the double dollar sign in JavaScript?</p>

<p>Thanks very much!</p>
