If it mysteriously freezes look for loop

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.

Last Updated: 2024-04-25

I was debugging a JavaScript web-page that made an external request which froze the browser. I suspected slowness of the web-request was the issue:

fetch(`${ibanMicroserviceBaseUrl}/generate_iban`, {
  method: "POST",
  body: JSON.stringify({
    country_code,
    bank_code,
    account_number
  })
})
.then(response => response.json())

After 10 minutes looking around in vain, this wasn't the cause. I eventually found an unintentionally infinite loop:

while (accountNumberLength < 10) {
  leadingDigitsAdded = true
  // This should have an increment of the `accountNumberLength` field
}