var cart = {
_wheels: 4,
get _wheels () {
return this._wheels;//Maximum call stack size exceeded
},
set _wheels (value) {
if (value < this._wheels) {
throw new Error('数值太小了!');
}
this._wheels = value;
}
}
console.log(cart._wheels);
cart._wheels = 1;
console.log(cart._wheels);
建议看看这篇文章:关于JavaScript中Get/Set访问器

然后就是,我把你这段代码复制进我的 VS Code 中时,显示是这样的:
所以,一个好的编辑器能够帮你直接发现问题。