The OO way of JavaScript
This is something I picked up in making my own functions and trying not to effect my other js libraries. I first start by creating a base function like so:
function Wrapper() {
}Then inside that function I create my “methods” if you will…
function Wrapper() {
this.MyMethod = function(var) {
return var;
}
}Once I am done creating the methods I now need to call my new javascript methods, I can do this by creating a new instance of my function that wraps the methods.
var MyScript = new Wrapper();
After creating the new instance I can now call my methods.
MyScript.MyMethod('Some Text');


