/我是按书上打出来的 为什么显示range is not defined,不太明白,我也没得range没定义,但不知道哪里错了/function Range(from,to){ this.from=from;
this.to=to;
}
Range.prototype={ includes:function(x){
return this.from<=x&&x<=this.to;
}, foreach:function(f){ for(var x=Math.ceil(this.form);x<=this.to;x++)f(x);
}, toString:function(){ return "("+this.form+"..."+this.to+")";
}
};var r=range(1,3); //r.includes(2); //
添加回答
举报
0/150
提交
取消