Design Pattern

I am trying to figure out how to put these tow functions into a design pattern.  Is it possible?

/*Format date for mysql */
String.prototype.changedate = function () {
    var mdarr = this.split('-');
    month = mdarr[1] - 1;
    var montharray = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
    newdate = montharray[month] + " " + mdarr[2] + ", " + mdarr[0];
    return newdate

Number.prototype.toPhone = function () {
    myStr = this.toString().replace(/(\d{3})(\d{3})(\d{4})/, '$1-$2-$3');
    return myStr

Open in new window

Who is Participating?
It looks like you are already using the Module pattern to me (

What else are you looking for exactly?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.