Web browser crashing When running for loops

Hello,

I am running a coding class and have come across an issue I am not sure how to deal with, or even the root cause.

I have started on a unit that teaches arrays, and when running simple for loops to iterate over the data (10 items or less) chrome freezes/gives the prompt to wait/close the page down. While my lab is older, I do not think it is directly related to that, the same issue happens on my computer as well. Is there a memory issue with chrome that could cause this?

Is there a way to work around this issue?

Are you sure it is an issue as It seems unlikely that Chrome cannot handle simple loops to iterate over arrays. If this was the case Chrome would fail with millions of websites.

Personally I use Firefox almost exclusively and the only time I have experienced the browser wanting to close the page down was due to either

  • errors in my code.
  • infinite loops / recursion (logic errors in my code)
  • processor intensive function that requires many seconds and hinders event handling. (Solved by using web worker threads)

I suggest that you test the affected code in another browser, if the problem persists then it is probably a programming error of some sort.

2 Likes

Thank you, I will double-check the code.

You most likely have a loop that never ends. One of the most common reason for crashes / wait in web pages.

100% that is what it was. I did a dumb.

3 Likes