1.js中的函数也是当做对象处理的,所以一些声明都可以采用对象的形式来展开举例:
var Testfunction = function (servicename){ }; Testfunction.prototype.service="win!!"; Testfunction.prototype.sysout = function(){ return this.service; }; function createClick(){ var testobj =new Testfunction(); alert(testobj.sysout()); }
其中函数 Testfunction 其实是函数对象,只要new一个它,就会存在service,sysout两个属性