square.js超出最大调用堆栈大小
我试图在循环中使用拉丁方库来查找一些模式,运行脚本,2分钟后出现此错误:
RangeError:超出最大调用堆栈大小
var latinSquare = require("latinsquare");
var lookup;
var loop;
lookup = ls();
console.log("first: "+ lookup);
/*---------------------------------------------------------------------------------------------------------------------------------*/
function find() {
lookup = ls();
console.log("loop: " + lookup);
if(codeM(000000) == "1558" && codeM(111111) == "8691"){
console.log("find: " + lookup);
clearInterval(loop);
}
}
loop = setInterval(find,500);
/*---------------------------------------------------------------------------------------------------------------------------------*/
function ls(){
var table = [];
lookup = latinSquare.generate([0,1,2,3,4,5,6,7,8,9]);
for(i=0;i<lookup.length;i++){
for(d=0;d<lookup[i].length;d++){
table.push(lookup[i][d]);
}
}
return table;
}
/*---------------------------------------------------------------------------------------------------------------------------------*/
function codeM(data){
// this function return a result of mathematic procces. not call another function.
}
function padLeft(nr, n, str){
return Array(n-String(nr).length+1).join(str||'0')+nr;
}
那么...在数学函数中寻找一个模式,我需要下面的代码来无限工作。 我是一个JavaScript的初学者,我不知道如何解决它
var latinSquare = require("latinsquare");
var count = 0;
的setInterval(函数(){
var table =[];
var search = latinSquare.generate([0,1,2,3,4,5,6,7,8,9]);
for(i=0;i<search.length;i++){
for(d=0;d<search[i].length;d++){
table.push(search[i][d]);
}
}
count++;
console.log(count +“......”+ table);
},100);
链接地址: http://www.djcxy.com/p/80243.html