Over time, I created a bunch of different JavaScript functions. Most of them are static functions and do things such as changing the date of a date, creating a menu for selecting HTML from an array, etc.
Currently, I have them all in a file called general.js, which, in turn, is directly called by my HTML page, and each of them looks something like this:
function modifyDate(data){....} function makeArray(arr){....}
And then I use them like:
alert(modifyDate("12/14/2013"));
I think this is a bad idea, as it may contradict other libraries. Instead, I think of something like the following:
myLibrary={}; myLibrary.modifyDate= function(data){....} myLibrary.makeArray= function(arr){....}
And they use them like:
alert(myLibrary.modifyDate("12/14/2013"));
Notice that I kind of do it when I go. Please provide recommendations on how to best organize your JavaScript library. thank you
source share