I'm trying to write a recursive method which may take a array/value as input and then process the input.
<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>
When I try to run this program, It seems like going to an infinite loop. Why is it?