mardi 1 août 2017

Webpage freezes after if statement

I have a lot of JavaScript in a webpage, and when I click a button a lot of it runs. However, the webpage freezes. For more details, click here. Using console.log, I narrowed the faulty code to these lines (everything is defined):

if (typeof bubble !== "undefined") {
    console.log("hi");
    bubbles.push(bubble);
};

The console.log doesn't run. Placing it like this:

console.log("hi");
if (typeof bubble !== "undefined") {
    bubbles.push(bubble);
};

The console.log does run.
So, why does the webpage freeze on this line? It's perfectly fine, I think.

Aucun commentaire:

Enregistrer un commentaire