I don't trust myself around while loops, so if I absolutely must use one, I set it up like this.

1let sanity = 0;
2
3// make sanity a high number you don't expect
4while(SOME_CONDITION && sanity < 10000) {
5 sanity++;
6 // do stuff
7}

No infinite loops from yours truly.

social.lol/@bw/117323178432680456