Search code examples
javascriptsizzle

Sizzle JS how does it work?


I was looking into the sizzle.js source code for a school project, and I noticed something strange. At the bottom of the code there is this line of code saying:

window.Sizzle = Sizzle;

But i can't find anything in the code saying anything about a:

var Sizzle = .....

The only thing i find that would resemble the Sizzle variable would be:

function Sizzle( selector, context, results, seed ) {

Now for my question. Is it possible for a function to act as an object like this? Or is it something that I've missed?


Solution

  • Yes, a function is itself a Javascript object and can be assigned to some other variable.