During an API url call in my web application, my html page is crashes unexpectedly and throws a 'out of memory' error. I'm really not sure what the problem is. I am using xhr object to fetch data from server. I tested multiple hotel search api from
CodePudding user response:
Looks like you have an infinite loop in your code.
You will want to check that the loop ends based on the size of the length of the array...
for (let i = 0; i < hotelObj.length; i ) {
CodePudding user response:
I have replaced traditional for loop with foreach loop structure. The problem seems solved right now. In tradition for loop, the loop may executing infinite times which is causing out of memory exception