Usually the demo variable is used in our demos in order to be able to access variables assigned in the aspx page (like controls accessed by ClientID, which is not available from an external JS file).
For example, in the LightBox overview demo, the "demo" variable is defined in the scripts.js file, while its value is assigned in the aspx page: