2
我试图写一个递归方法,它可能需要一个array/value
作为输入,然后处理输入。JavaScript递归问题
<html>
<body>
<script>
function process(array){
if (array instanceof Array) {
for(i=0; i < array.length; i++){
process(array[i]);
}
} else {
document.write(array + "<br />");
}
}
process([3, 4, 5, [4,1], [5,1,2],[6,1]]);
</script>
</body>
</html>
当我尝试运行这个程序,它似乎会去一个无限循环。为什么?