<!--菜鸟的文章,感谢指出不当之处--> 试图删除原型成员 function Polygon() { var m_points = []; m_points = Array.apply(m_points, arguments); function GETTER(){}; GETTER.prototype = m_points[0];//x,y作为原型成员 this.firstPoint = new GETTER(); } var p = new Polygon({x:1, y:2},{x:2, y:4}); alert(p.firstPoint.x);//output 1 delete p.firstPoint.x;//不能删除原型的成员(但除原型的成员的属性可以删除) alert(p.firstPoint.x);//output 1 again 下面稍作改变,把m_points作为原型成员,在下面的代码中x,y作为原型成员m_points的属性,而上面的代码中x,y直接作为原型成员 function Polygon() { var m_points = []; m_points = Array.apply(m_points, arguments); function GETTER(){}; GETTER.prototype = m_points;//m_points作为原型成员 this.firstPoint = new GETTER(); } var p = new Polygon({x:1, y:2},{x:2, y:4}); alert(p.firstPoint[0]);//output 1 delete p.firstPoint[0];//这里把原型成员的属性x删除 alert(p.firstPoint[0]);//output undefined