cosmos
Cosmos
search
blog Hello comment
{ "articleTitle": "扫雷", "date": "2022-3-29 23:25:40", "tags": [ "vue", "js" ], "categories": "vue", "timestamp": 1648596340000, "readingTime": 2, "outline": " 问题记录 Maximum call stack size exceeded而Maximum cal" }
readingTime: 2min

问题记录

Maximum call stack size exceeded

而Maximum call stack size exceeded 的意思就是,浏览器的这个栈溢出了。一般都发生在递归中,调用自己的时候没有停止的条件。相当于这个栈只进不出,最后结果当然是溢出。

例如:

function a() {
  a();
}
a();

扫雷里点击翻开的时候,如果已经翻开就不要再递归了,不然会对已翻开的块反复执行expandZero(),导致溢出。

箭头函数callback 不想用item

Array.from({ length: 10 }, (_, x) => {
  return x;
});

可以写个_ ,只用到了x,即index。

另外

Array.from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];

interface ArrayLike<T> {
   readonly length: number;
   readonly [n: number]: T;
}

第一个参数,数组参数,第二个参数可以写回调

vue里的响应式: reactive和ref

const permission = reactive({
  disabled: false,
  dev: false,
});

// ...TODO

Edit on Github