Over time, I created a bunch of various JavaScript functions. Most of them are static functions, and do things like modify the appears of a date, create the select menu HTML from an array, etc.
I currently have them all in a file called "general.js" which is in turn directly called by my HTML page, and each of them look something like:
function modifyDate(data){....}
function makeArray(arr){....}
And then I use them as:
alert(modifyDate("12/14/2013"));
I am thinking this is a bad idea as it might conflict with other libraries. Instead, I am thinking of something like the following:
myLibrary={};
myLibrary.modifyDate= function(data){....}
myLibrary.makeArray= function(arr){....}
And them use them as:
alert(myLibrary.modifyDate("12/14/2013"));
Note that I am kind of making this up as I go. Please provide advice how I should best organize my JavaScript library. Thank you