The JavaScript Array intrinsic object (and others) can be extended to include user-defined functions in the object definition. These extensions can be placed in a .js file and included in all pages to create a common library.
In the example below, the Array object has been extended with a contains function that checks the array for the specified string. The caseSensitive global variable is used to indicate case comparison. All instantiated arrays will now be able to use the .contains method.
Array.contains
size=3>