Javascript Object oriented Main Concepts
Create Global Namespace
var Myns= Myns|| {};
MYAPP.commonMethod = { regExForName: "", regExForPhone: "", validateName: function(name){ }, validatePhoneNo: function(phoneNo){ // do with number } } // Object together with the method declarations MYAPP.event = { addListener: function(el, type, fn) { // code stuff }, removeListener: function(el, type, fn) { // code stuff }, getEvent: function(e) { // code stuff } // Can add another method and properties } // Syntax for Using addListener method: MYAPP.event.addListener("anynm", "type", callback);