第一種:function Point(x, y) { this.x = x; this.y = y;}Point.prototype.add= function () { return this.x};var p = new Point(1, 2);第二種:function point2(x,y){ var o = {}; o.x = x; o.y = y; o.add= function(){ return o.x } return o}var p1 = point2(1,2)請問兩者之間的差異?
這兩種函數方法有什么區別??
茅侃侃
2019-02-11 17:12:37