JS把某个对象复制给另外一个对象,报了Invalid left-hand side in assignment。在代码的17行,我想把这个对象的左边一个对象复制给这个对象,但是始终搞不定var MATRIX = 5;var Point = function(x,y){ this.x = x; this.y = y; this.nth = (this.y*MATRIX) + this.x; return this;}Point.prototype = { constructor : Point, left : function(){ if(this.x > 0){ return new Point(this.x-1,this.y); } }, moveL : function(){ //这一行总是报错 Invalid left-hand side in assignment this = this.left(); }}var p = new Point(2,3);p.left();p.moveL();我哪里出了问题呢?
添加回答
举报
0/150
提交
取消