function N() {}
    N.prototype = {}
    
    var n1 = new N();
    var n2 = new N();
    alert(n1.prototype === n2.prototype);
    alert(n1.prototype === N.prototype);

解决方案 »

  1.   

    new之后会生成新对象。
       
    var n1 = new N();
    var n2 = new N();
    //n1 n2在使用了new生成的新对象都是object类型,并没有prototype属性。
    alert(n1.prototype === n2.prototype);//true, n1.prototype === undefined,n2.prototype === undefined;  undefined === undefined; 
    alert(n1.prototype === N.prototype); //false, n1.prototype === undefined,N.prototype === object; undefined !== object;//N为function类型,prototype是function的原型链,经常被用来模拟继承。
    //function类型的对象,默认的prototype都为object
    //所以楼主的 N.prototype = {} 这句代码并无实际意义。