<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script type="text/javascript" src="./jquery-1.10.1.min.js"></script> <script> function AClass() { } AClass.staticMethod=function() { alert("静态方法"); } //AClass.staticMethod(); AClass.prototype.instanceMethod=function() { alert("原型里面的方法instanceMethod"); } function AClass() { this.instanceMethod=function() { console.log("构造函数里面的instanceMethod"); } } var a=new AClass(); a.instanceMethod(); //记住,虽然原型里面也有instanceMethod方法,不过实例是先去构造函数里面找,找不到就去原型那里找 //举个例子,是不是自己没有才去有的人里面买啊是吧。 </script> </body> </html>
jQuery第八篇 静态方法和实例方法
关注
打赏