Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7199

My browser lags when I try a loop function?

$
0
0

I wrote a simple nested loop function to multiply all items in an array and output the total value, but each time is I run a loop function my browser either crashes or doesn't stop loading

function multiplyAll(arr){         Let product = 1;       for(let i = 0; i <             arr.length; i++){            for(let j = 0; j <      arr[i].length; j *= product);     }      return product;}multiplyAll([[1], [2], [3]]);

Viewing all articles
Browse latest Browse all 7199

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>