prototype里的函数不能直接用吗
//test.js(function(){ var cls = function(){} cls.prototype = { func: function() { alert('func'); }, create: function() { func(); } } cls.prototype.create();}());<html> <head> <script src = 'test.js'></script> </head> <body> test </body></html>
var func = function(){ alert(123)};(function(){ var cls = function(){} cls.prototype = { func: function() { alert('func'); }, create: function() { func(); } } cls.prototype.create(); // 这样调用func的对象是window}());