1. JavaScript Flexible language
Way One,
function CheckName () {} function Checkemail ()) {}function Checkpassword () {}
Way Two,
var checkname=function() {}var checkemail=function() {} var checkpasswork=function() {}
Mode 11 and mode two are global scope variables, the way two can intuitively say that the function is also a variable in JavaScript, but the definition of the location is different
2. Using the object to incorporate variables
Way One,
var checkobject={ checkname:function() {}, Checkemail: function() {}, Checkpassword:function() {}}
Way Two,
var function functionreturn This function return this functionreturnthis; }
3. True and False objects
var function () { return { function () {}, function () { }, function () {}} }
var obj= checkobject ();
Obj.checkname ();
4. Class Form
var function () { thisfunction () {}; This function (){ }; This function (){ };} var New Checkobject (); Obj.checkname ();
5. Prototype form
Way One,
var function functionfunction= function () {}
Way Two,
var function () { return { function () {}, function () { }, function () {}} }
6. Prototype form plus Return
var function functionreturn This function return this functionreturnthis; }
Way Two,
var function () { return { functionreturnthis;}, functionreturn this;}, functionreturn This;}} }
JavaScript Design Pattern Series One