我有一个使用每个函数的函数,但是问题是我希望它运行或循环14次,但是它循环14次以上,直到给出错误
Uncaught RangeError: Maximum call stack size exceeded
正如您在下图中看到的那样,它不会在14处停止,而是在0,1,2等处重新开始...
我尝试过
if(index = 14){
return false;
}
我也尝试休息一下
目前我给出错误的代码是:
var type = [];
type[1] = $("#type_1").val();
type[2] = $("#type_2").val();
type[3] = $("#type_3").val();
type[4] = $("#type_4").val();
type[5] = $("#type_5").val();
type[6] = $("#type_6").val();
type[7] = $("#type_7").val();
type[8] = $("#type_8").val();
type[9] = $("#type_9").val();
type[10] = $("#type_10").val();
type[11] = $("#type_11").val();
type[12] = $("#type_12").val();
type[13] = $("#type_13").val();
type[14] = $("#type_14").val();
$.each(type, function( index, type ) {
console.log( index + ": " + type );
});
我希望我可以循环使用数组中的每个函数,仅此而已! 感谢您的帮助。