prototype是指对象的原型。
Function.prototype.extend=function(properties){};这样写后, 没有一个Function对象都有extend 这个方法了。他和Function.extend 是不一样的。你用Function.extend();这样写是不对的。现在来测试一下:
<script>
 // Function.prototype.extend = function(){};
  String.prototype.extend = function(){alert(1)};
  alert(Function.extend)
  alert(Function.prototype.extend)
  alert(String.extend)
  alert(String.prototype.extend)
  </script>结果:
undefined
undefined
undefined
function(){alert(1)}再来打测试::
<script>
  Function.prototype.extend = function(){alert(2)};
  String.prototype.extend = function(){alert(1)};
  Function.extend();
 String.extend();
  alert(Function.extend)
  alert(Function.prototype.extend)
  alert(String.extend)
  alert(String.prototype.extend)
  </script>结果:
2
2
function(){alert(2)}
function(){alert(2)}
function(){alert(2)}
function(){alert(1)}从结果可以看出:Function.extend()和String.extend()都是调用的Function.prototype.extend方法。

解决方案 »

  1.   

    1楼的仁兄??
    what are you doing ?????貌似没看清我的问题吧
      

  2.   

    简单例子:var a = function(){}
    a.prototype.extend = function x(){}
    var b = new a();
    alert(b instanceof a)//true
    alert(b.constructor)//function(){}
    alert(b.extend +"\r\n"+ a.prototype.extend)//这个不难理解
    就我所知道的,实际上Function是Function对象的实例化对象(-_-#)。
    这点LZ可以通过以下代码证明:alert(Function instanceof Function);//true
    alert(Function.constructor)
    /*
    输出
    function Function() {
        [native code]
    }
    */很怪吧?所以Function.prototype.extend 和 Function.extend是同个函数体。
      

  3.   

    至于Array.indexOf,这个完全是ff实现的方法。和lz的疑问无关。
      

  4.   

    Function.prototype.extend=function(properties)看成是继承关系更加容易理解吧.