Creating Custom JavaScript Objects
JavaScript API Reference
Creating Custom JavaScript Objects
If you have several JavaScript variables and functions that are logically related, you have an option of creating a custom JavaScript object that would group these functions and data variables they operate on together. When done right, this will make your code easier to use and easier to maintain.