I'm trying to understand an application I use, and I've encountered a JavaScript idiom that I don't recognize.

The HTML page contains an inline script which contains the following code (the names are changed to protect the innocent):

$(function() {
  window.foo = new foo({...});
("{. . .}" represents a definition of a large object which I understand, and which isn't relevant.)

I see that the inner code creates an anonymous function which, when run, will create a new object of class foo, assign it to a property named foo on the window object, and execute the load method of the object.

But what does $( . . . ) mean? I'm familiar with the JavaScript idiom of creating a function named $ which returns a page element when given the element's name, but I don't think that's what is happening here. If it were, the code would be returning a page element whose name is an anonymous function -- and then doing nothing with it. Neither half of that makes sense!