JS的prototype属性用于方法名称的后面,而非JS对象的后面。prototype属性对方法的实例有效,对直接方法名无效。 function test(a, b) { this.x = a; this.y = b; } test.prototype.z = 'd'; var temp = new test('x', 'y'); var temp2 = new test('a', 'b'); //temp.z temp2.z 均为'd' test.prototype.z = 'z'; //所有test的对象(temp.z temp2.z)均的z属性均被设为了'd' //test.z则为undefined